| Name | Version |
| ---- | ------- |
| msw | 0.21.2 |
| node | 10.16.3 |
| OS | Windows 10 |
// Example of declaration. Provide your code here.
import { setupServer } from 'msw/node'
import { rest } from 'msw'
const server = setupServer(
rest.get('/project/project_id', () => {
// handle request
})
)
server.listen()
fetch('/project/4').then((res) => res.json())
Request fails to match.
Request should be matched by msw.
Note switching the URL parameter name to be projectId results in the matching working as expected.
I could not see any restrictions on variable naming in the documentation hence raising the issue as it took quite a while to figure out why the request was not being matched and don't want others to fall into the same trap.
Hey, @joe-hilling. Thanks for reporting this.
This is an issue in the node-match-path library responsible for request URL matching. We should tackle this in the nearest time. Would you be interested in issuing a pull request? I could then onboard you more in how it works and why there's an issue.
You can assign this one to me if @joe-hilling doesn't claim this issue.
Hi @kettanaito, I won't be able to take this on I am afraid. I am struggling to keep on top of my day job ATM. Also, am a bit of a hacker so probably not coding clean enough for production code.
Thanks to you and the team for library, it's saving my skin on a complex internal company project!
@joe-hilling, absolutely no worries! I'm already thankful for you finding and reporting this, you rock!
@timdeschryver, thanks for volunteering to battle this issue! I've created a task in the node-match-path repo (https://github.com/mswjs/node-match-path/issues/26). Would love to support you in this contribution. Looking forward to see the pull request!
Thanks to @timdeschryver the issue has been fixed and published in [email protected]. If you re-install your dependencies the fix should propagate in.