-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Headers with the same name get joined by comma that leads to confusion #465
Comments
We could return an array instead of combining the values, but that would be an important breaking change for the library |
I'm sorry but I read the standard for HTTP State Management and it states that
This is actually a bug. We'll look into it or will be happy to accept a PR. Thanks for reporting! |
Multiple headers were joined by comma which is unacceptable for `Set-Cookie`. Now multiple headers are returned as array. Fixes axios#465
Why not simply copy the Headers interface? res.headers.get('set-cookie') // Returns "cookie_key_1=yyy; Path=/"
res.headers.getAll('set-cookie') // Returns [ "cookie_key_1=yyy; Path=/", "cookie_key_2=xxx; expires=Mon, 17-Oct-2016 17:16:25 GMT; httponly; Max-Age=1209600; Path=/" ] You could also maintain the existing API, but also provide the getAll method. res.headers['set-cookie'] // Returns "cookie_key_1=yyy; Path=/"
res.headers.getAll('set-cookie') // Returns [ "cookie_key_1=yyy; Path=/", "cookie_key_2=xxx; expires=Mon, 17-Oct-2016 17:16:25 GMT; httponly; Max-Age=1209600; Path=/" ] |
Given the following HTTP response
Headers object is the following:
Seems like broken behaviour to me as it's not possible to split cookies into separate objects.
One of the solutions might be returning array in this case.
The text was updated successfully, but these errors were encountered: