Skip to content
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

Loosing cookies when used with msw library #1161

Closed
aristofun opened this issue Oct 29, 2024 · 3 comments
Closed

Loosing cookies when used with msw library #1161

aristofun opened this issue Oct 29, 2024 · 3 comments
Assignees

Comments

@aristofun
Copy link

Describe the bug

This is the bug on msw side mswjs/msw#2338

On all versions of msw after 2.4.3 as soon as you mswServer.listen({ onUnhandledRequest: "bypass" }); all axios requests are without cookie headers.

Directly setting a cookie header in axios call doesn't have any problems, indicating that the bug is not on axios side and maybe not on msw, but rather due to interference between msw and axios-cookiejar-support.

To Reproduce

  1. Download https://github.com/aristofun/bugs-js-msw or try terminal in https://glitch.com/edit/#!/windy-continuous-sandpaper (doesn't work for me :( )
  2. yarn && yarn start
  3. See how it fails after turning on msw
  4. Either change msw version to 2.4.3 in package.json or uncomment the code where you set cookie header directly in axios, or don't turn on msw server
  5. See no errors anymore

Expected behavior

Cookie headers from a cookie jar are passed through msw for each axios request.

Code that reproduces the bug

https://glitch.com/edit/#!/windy-continuous-sandpaper — I couldn't make it work there :(

Locally reproduce: https://github.com/aristofun/bugs-js-msw

Environments

  • OS: macOS 14,15
  • Node.js version: 20.17.0
  • axios version: latest
  • tough-cookie version: latest

This comment was marked as outdated.

@github-actions github-actions bot added the stale label Nov 28, 2024
@3846masa 3846masa removed the stale label Nov 29, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 29, 2024
Copy link

github-actions bot commented Jan 5, 2025

This issue was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants