Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 31deae8

Browse files
authoredAug 15, 2024··
fix: undefined property in unmatched host (#178)
1 parent cdf8ec4 commit 31deae8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎lib/router.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ Router.prototype.allowedMethods = function (options = {}) {
483483
return next().then(function () {
484484
const allowed = {};
485485

486-
if (!ctx.status || ctx.status === 404) {
486+
if (ctx.matched && (!ctx.status || ctx.status === 404)) {
487487
for (let i = 0; i < ctx.matched.length; i++) {
488488
const route = ctx.matched[i];
489489
for (let j = 0; j < route.methods.length; j++) {

0 commit comments

Comments
 (0)
Please sign in to comment.