-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Mocked response cookie persists after sending max-age=0
#2272
Comments
After a few hours of troubleshooting, I got some useful information. Everything works fine in v2.2.2, but I'm using v2.4.4. I found that MSW_COOKIE_STORE in localStorage will be read and written in v2.4.4, but v2.2.2 will not. |
@TinsFox, thanks for reporting this! Your observation is correct. We've moved away from a custom cookie store to using At first glance, looks like the When MSW received that msw/src/core/utils/HttpResponse/decorators.ts Lines 67 to 72 in 1263c0f
When the next request happens, here's where it decides which cookies will be exposed to that request: msw/src/core/utils/request/getRequestCookies.ts Lines 67 to 71 in 1263c0f
There are multiple cookie groups:
|
max-age=0
I've added a failing test in #2275, which confirms that we've got a bug. |
Pushed a fix in 517c8f2. |
Released: v2.4.5 🎉This has been released in v2.4.5! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
@kettanaito Thanks! But it doesn’t seem to be completely repaired. I forgot to add a scenario where I would manually clear cookies from devtool. I have upgraded my reproduction repository to 2.4.5. Please check again if there is any problem during this operation. Thank you very much! Here is my operation video |
Prerequisites
Environment check
msw
versionBrowsers
Chromium (Chrome, Brave, etc.)
Reproduction repository
https://github.com/TinsFox/mws-example
Reproduction steps
Get User
button and observe the console outputLogin
button and observe the cookie in devtoolGet User
button and observe the console output, you can find cookie in outputLogout
buttonGet User
button and observe the console output. You will find that the cookie is still not empty, but the cookie set when logging in before.Current behavior
Whether I clear the cookies through the API or manually clear the cookies, when I clear the cookies and then request the API, I can still get the old cookies.
Expected behavior
After I clear the cookie, the cookie obtained by requesting the API should be empty instead of the previously set one.
The text was updated successfully, but these errors were encountered: