Skip to content

Commit

Permalink
fix: undefined property in unmatched host (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
laverdet authored and 3imed-jaberi committed Sep 17, 2024
1 parent da90e35 commit 1a1301a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 1a1301a

Please sign in to comment.