From 31deae8b821d95010945a26d1d847b0f984f1581 Mon Sep 17 00:00:00 2001 From: Marcel Laverdet Date: Wed, 14 Aug 2024 19:55:36 -0500 Subject: [PATCH] fix: undefined property in unmatched host (#178) --- lib/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/router.js b/lib/router.js index 0dae41e..ece7ac5 100644 --- a/lib/router.js +++ b/lib/router.js @@ -483,7 +483,7 @@ Router.prototype.allowedMethods = function (options = {}) { return next().then(function () { const allowed = {}; - if (!ctx.status || ctx.status === 404) { + if (ctx.matched && (!ctx.status || ctx.status === 404)) { for (let i = 0; i < ctx.matched.length; i++) { const route = ctx.matched[i]; for (let j = 0; j < route.methods.length; j++) {