Closed cooperhsiung closed 2 years ago
@3imed-jaberi, @alecmev can you look at it?
We have just published @koajs/router
v11.0.0 which resolves this issue. This is mirrored to koa-router
as well.
https://github.com/koajs/router/releases/tag/v11.0.0
This project is maintained by Forward Email and Lad.
ctx.params
is unexpectedly affected by other routerssend a request
what is expected is
hello, user is 123
, instead ofhello, user is :userId
I found that the problem stemmed from this line:
https://github.com/koajs/router/blob/1aead99e0e0fdb8666e9c6fa2f52b0463c622025/lib/router.js#L366
It seems that it has caused a series of problems
originnal feature imports
unexpected code import
related pull requests
related issues
ctx.params shouldn't have been affected by other routers, this looks like a bug that needs to be fixed for this essential module of the koa ecosystem.
In order not to break compatibility, I choose to restore
ctx.routerPath
after layers match and added corresponding tests