From 76020dd0a41dc9161731488cd48d5e803c2d499b Mon Sep 17 00:00:00 2001 From: Lionel Besson <52779391+lbesson-della@users.noreply.github.com> Date: Fri, 13 Sep 2024 00:08:01 +0200 Subject: [PATCH] fix: allowedMethods() should not fail if more than one router is defined (#183) 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; }