Multi routes will be called if the last middleware call next()
jiladahe1997 opened this issue · comments
node.js version: v12.9.0
npm/yarn and version: 6.10.2
koa-router
version: 7.4.0
koa
version: 2.11.0
Code sample:
router.get("/", async (ctx, next) => {
console.log("match /");
await next();
ctx.body = "Hello";
});
router.get("/*", ctx => {
console.log("match /*");
});
Expected Behavior:
match /
Actual Behavior:
match /
match /*
Additional steps, HTTP request details, or to reproduce the behavior or a test case:
I'm new to Koa2, and I have misused next() in the last middleware. I don't think this will do anything and return , but actual it do something, it calls the next route.
I think that is strange, and I'm not sure if it's a bug.
I think this means I can not use most third Community middlewares as the last one, beacause they will call next().
Thanks for reading , a simple demo is here