From ba0af73ab5d8f43250e689cbe5c4318b7f92d61d Mon Sep 17 00:00:00 2001 From: Landon Date: Mon, 26 Sep 2022 15:05:02 -0700 Subject: [PATCH] Fix for automatic HEAD routes HEAD routes now get automatically added in Fastify causing and issue when the path exists (via GET) but the HEAD method does not. This fix covers that case. --- lib/dictionary.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/dictionary.js b/lib/dictionary.js index ad7fddf..feae720 100644 --- a/lib/dictionary.js +++ b/lib/dictionary.js @@ -31,6 +31,10 @@ module.exports = class ValidatorDictionary { [httpPart]: validator } } + } else if (this[kSchemas][path][method] == null) { + this[kSchemas][path][method] = { + [httpPart]: validator + } } else { this[kSchemas][path][method][httpPart] = validator }