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

Make headers with the same name be returned as array #477

Closed
wants to merge 2 commits into from

Conversation

kompot
Copy link

@kompot kompot commented Oct 11, 2016

Instead of being joined with a comma.

Fixes
#465

Multiple headers were joined by comma which is unacceptable for
`Set-Cookie`. Now multiple headers are returned as array.
Fixes axios#465
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 94.419% when pulling c2a4b20 on kompot:master into 12341d8 on mzabriskie:master.

@@ -29,7 +29,15 @@ module.exports = function parseHeaders(headers) {
val = utils.trim(line.substr(i + 1));

if (key) {
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
if (parsed[key]) {
parsed[key] = utils.isArray(parsed[key])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use this shorter version:

parsed[key] = [].concat(parsed[key], val);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted. Done.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 93.719% when pulling 5f08fab on kompot:master into 12341d8 on mzabriskie:master.

@rubennorte
Copy link
Member

rubennorte commented Apr 8, 2017

Sorry but we'll finally go with #558 as it's more consistent with Node.js. Thanks for your contribution.

@rubennorte rubennorte closed this Apr 8, 2017
@axios axios locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants