-
Notifications
You must be signed in to change notification settings - Fork 11
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
Set-Cookie response headers lose semantics #309
Comments
Doing some debugging reveals that the concatenation happens in Lines 104 to 109 in c55384f
namely in normalizeValue :Lines 40 to 41 in c55384f
The explicit String cast turns the [5] array in the example above into a string concatenated with commas.
|
Note that the fetch living standard says the following:
https://fetch.spec.whatwg.org/#ref-for-dom-headers-get%E2%91%A0 |
the problem with the I think it would be better / useful to receive all values of a multi-header header via api. eg:
or
or exposing https://fetch.spec.whatwg.org/#concept-header-list
|
as far as I understand, https://github.com/node-fetch/node-fetch/pull/253/files adds multi-headers as array for |
yes, that's the plan. need to change the internal representation though. |
BTW
That's in fact exactly what the browser (Chrome) does: const h = new Headers()
undefined
h.append('x-cookie', ['foo=1', 'bar=2'])
undefined
h.get('x-cookie')
'foo=1,bar=2' |
🎉 This issue has been resolved in version 3.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
When a server returns more than one
set-cookie
response headers, theresponse.headers.get('set-cookie')
will return one value, where all values are concatenated by commas.To Reproduce
Steps to reproduce the behavior:
set-cookie
headers, e.g. https://www.dropbox.comresponse.headers.get('set-cookie')
curl
:you'll notice that
response.headers.get('set-cookie')
looks like this (line feeds added for readibility):Using a standard cookie parser, it will report that there's a
Secure,t
cookie, because it is unable to determine that the former is a flag for the firstgvc
cookie.Expected behavior
It should be possible to parse the cookies received, either by getting the initial N values for that header or by using a different delimiter.
The text was updated successfully, but these errors were encountered: