-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Jest is causing multiple HTTP cookie headers to be merged into one cookie value. #7700
Comments
Updated demo code to use |
Yeah, this is essentially a dupe of #2549. The case of |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
When using Jest with the request lib (I also tried node-fetch and saw the same issue) to test a server response with multiple cookies returned, Jest will join the cookies into one string in the response object. Removing Jest resolves the issue.
To Reproduce
Steps to reproduce the behavior: See Repl link below. Local test server works as expected without Jest.
index.js
will execute the same logic without Jest first and the header is as expected. It will then execute the code through a Jest test file which then munges the set-cookie header value when multiple cookies are sent.Expected behavior
With a response header including multiple cookies (e.g. "foo=bar" and "bar=foo"), expect the response object from
request
to have a header value forset-cookie
to be an array of those cookies (e.g.["foo=bar", "bar=foo"]
). However with Jest, the example header value would be["foo=bar,bar=foo"]
.Link to repl or repo (highly encouraged)
A demo.
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: