From 6352221321f48b61c3bc99b1fee38a2782f57454 Mon Sep 17 00:00:00 2001 From: Lionel Besson <52779391+lbesson-della@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:09:30 +0200 Subject: [PATCH] fix: allowedMethods() should not fail if more than one router is defined Fixes https://github.com/koajs/router/issues/182 --- lib/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/router.js b/lib/router.js index a806b85..f269482 100644 --- a/lib/router.js +++ b/lib/router.js @@ -228,7 +228,7 @@ class Router { ctx.routerPath; const matched = router.match(path, ctx.method); if (ctx.matched) { - ctx.matched.push(matched.path); + ctx.matched.push.apply(ctx.matched, matched.path); } else { ctx.matched = matched.path; }