| Name | Version |
| ------- | ------- |
| msw | ^0.19.5 |
| browser | Firefox |
| OS | MacOS |
// Example of declaration. Provide your code here.
import { setupWorker, rest } from 'msw'
const worker = setupWorker(
rest.patch('area-code', (req, res, ctx) => {
return res(ctx.status(200), ctx.json({ ...req.body }))
}),
rest.patch('activate', (req, res, ctx) => {
return res(ctx.status(200), ctx.json({}))
}),
)
worker.start()
fetch
// Example of making a request. Provide your code here.
useMutation(() =>
fetch(`${baseUrl}${path}`, { headers, method, body }))
The PATCH request is only processed once. Either on the same route or a different route. This works fine in Chrome.
Every request that matches should get intercepted.
Hey, @deshiknaves. Thanks for reporting this. That doesn't sound like the right behavior, so we need to look into it.
@marcosvega91, please, would you have time to help with this issue? Please let me know. Thanks.
Hi @kettanaito yes I can take a look into it 馃槃
I have tried to reproduce the issue without success. I have tried to do more than a PATCH request on chrome and firefox and it is working. Do you have a reproduction repo? Maybe could be a problem related to the use of react-query with msw
@marcosvega91 I'll see if I can get a repo up tomorrow with the issue in it.
Thanks this will be awesome 馃コ
As a debugging measure, you can try starting your worker with onUnhandledRequest: 'error' option. If the issue is in the request matching, you will get an error and more information about the second (uncaptured) PATCH request.
worker.start({ onUnhandledRequest: 'error' })
Yep, I can't recreate it on a new application even with the same route structure. I can on another application. Time for me to look at what version of dependencies are there. If it has anything to do with MSW, I'll open this again.
It just fails to intercept the second call, but not an issue in Chrome.
Most helpful comment
Yep, I can't recreate it on a new application even with the same route structure. I can on another application. Time for me to look at what version of dependencies are there. If it has anything to do with MSW, I'll open this again.
It just fails to intercept the second call, but not an issue in Chrome.