We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const nested = new Router() .get('/', (ctx, next) => { ctx.body = "root"; console.log("root"); return next(); }) .get('/test', (ctx, next) => { ctx.body = "test"; console.log("test"); return next(); }); const router = new Router() .use(nested.routes());
GETting /test prints to console:
/test
root test
It is really unexpected behaviour! Maybe related to #369 because the problem is with setting (.*) prefix in Router.use() function.
(.*)
Router.use()
One more wrong thing with this behaviour: GETting /xxx will execute root although it should throw 404.
/xxx
root
router.use('', nested.routes())
can be used as workaround.
The text was updated successfully, but these errors were encountered:
remove default wildcard prefix for nested routers
ff15285
fixes what looks like a regression in 8665620 in which `path` inside of `.use()` is defaulted to a wildcard `(.*)` instead of remaining undefined while the line: if (path) nestedLayer.setPrefix(path) runs. https://github.com/alexmingoia/koa-router/blob/840591d4f660ddde98aedc689dea862a7e63f55b/lib/router.js#L265 This fixes #369 and #410 A test case has been added.
This should be fixed in 7.4.0
Sorry, something went wrong.
No branches or pull requests
GETting
/test
prints to console:It is really unexpected behaviour!
Maybe related to #369 because the problem is with setting
(.*)
prefix inRouter.use()
function.One more wrong thing with this behaviour: GETting
/xxx
will executeroot
although it should throw 404.can be used as workaround.
The text was updated successfully, but these errors were encountered: