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 Aug 15, 2024
1 parent cdf8ec4 commit 31deae8
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 31deae8

Please sign in to comment.