We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cdf8ec4 commit 31deae8Copy full SHA for 31deae8
lib/router.js
@@ -483,7 +483,7 @@ Router.prototype.allowedMethods = function (options = {}) {
483
return next().then(function () {
484
const allowed = {};
485
486
- if (!ctx.status || ctx.status === 404) {
+ if (ctx.matched && (!ctx.status || ctx.status === 404)) {
487
for (let i = 0; i < ctx.matched.length; i++) {
488
const route = ctx.matched[i];
489
for (let j = 0; j < route.methods.length; j++) {
0 commit comments