-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
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
Router.match is returning pathAndMethod matches for layers without methods such as nested routers or middleware #105
Comments
I have a branch with fixes. I just need to figure out what I need to do to get permission to push to here. |
Hi @Gary-Osteen-Q2, I havent had time to look into the issue you are having but it sounds like you have found a solution 😄. In order to push your fixes to this repo you will need to submit a Pull Request.
Hope this helps |
I figured it out. First time contributing to open source. Learned a lot. |
@dominicegginton Have you got a chance to look over my PR yet? I'm curious if it meets the standards and want to include a new version in the project I am using this in. I have a workaround for the time being. Thanks in advance for any insights and feedback. |
@dominicbarnes @niftylettuce: This is @Gary-Osteen-Q2's first open source contribution. I believe these changes are required/related to the following upstream issue for Koa's Open Telemetry instrumentation plugin: |
Description
When using nested routers and other middleware, the Router.match can include layers without methods in the matched.pathAndMethod array. This can cause issues downstream when setting the ctx._matchedRouteName, causing named routes to not be set properly. The assumption being that the last item in the pathAndMethod array being the most specific layer.
node.js version: v12.18.3
npm/yarn and version: 6.14.6
@koa/router
version: 9.4.0koa
version: 2.13.0Code sample:
Expected Behavior:
Only layers with path and methods should be included in matched.pathAndMethods array.
Actual Behavior:
Any layer which matches the given path will appear in matched.pathAndMethods array. Even if the layer has zero methods associated with them.
The text was updated successfully, but these errors were encountered: