-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
Bypassed requests miss cookie headers with axios + axios-cookiejar-support #2338
Comments
I suspect this has to do with how |
Root causeThis was a fun exercise to untangle. First, Then, the custom There was the culprit. Interceptors tap into the I've added the fix in mswjs/interceptors#666, alongside the test for this use case. |
Wow, amazing job! You're saving all those like me who want to have just 1 client (axios) evertywhere - server, client, tests |
Just as a side note - curious what whas different in msw <2.4.4 in that area |
@aristofun, somewhere along those versions we've migrated to a new interception algorithm that's socket-based. That's the main difference. The issue is non-trivial though. To fix it, we need to call Obviously, that won't work when you want to mock a request. I'm exploring what we can do to allow the Any thoughts are welcome on this! |
Hmm, what do you think might be downsides of patching default Sounds to me like you have to do it one way or another, if |
Apart from meddling with another object, not much. I would love not to do that if we can, but I don't see how. We have to make sure custom agents taping into
Kind of. I treat this as a niche use case but it would be great to support it anyway. |
I'm happy to test alpha version of your solution on my personal project where this issue originally came from. If that helps. |
Keep an eye on this issue to know when there's an update. We publish preview releases now so you will have what to try, thanks. |
Prerequisites
Environment check
msw
versionNode.js version
20.17.0
Reproduction repository
https://github.com/aristofun/bugs-js-msw
Reproduction steps
Minimal example: https://github.com/aristofun/bugs-js-msw
Change the msw version to 2.4.3 reinstall and
yarn start
to see the difference.Current behavior
After
mswServer.listen({ onUnhandledRequest: "bypass" });
all localhost requests issued byaxios
in the same process are stripped off all cookie headers.Reproduced on all msw versions starting with
2.4.4
Explicitly adding cookie header like this:
Works. That means the problem is with interference with
axios-cookiejar-support
Expected behavior
mswServer.listen({ onUnhandledRequest: "bypass" });
should not interfere withaxios-cookiejar-support
The text was updated successfully, but these errors were encountered: