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

Allow setting an array of header values in the response #1477

Merged
merged 1 commit into from Jan 24, 2013

Conversation

gmethvin
Copy link
Contributor

Make setting multiple header values using an array work as expected.
If the header value is an array, coerce the values to strings instead
of the entire array.

Fixes #1419.

Make setting multiple header values using an array work as expected.
If the header value is an array, coerce the values to strings instead
of the entire array.

Fixes expressjs#1419.
@tj
Copy link
Member

tj commented Jan 24, 2013

-1 from me, I think arrays for header fields is crazy awkward

@gmethvin
Copy link
Contributor Author

What is the accepted way in express to set multiple headers with the same name? It seems like you'd have to fall back to a lower-level API to make it work.

I agree it's awkward, but all we're really doing is imitating the underlying response.setHeader behavior with some extra string coercion.

@tj
Copy link
Member

tj commented Jan 24, 2013

currently other than the special-cased .cookie() you'd have to, but yeah I guess you're right, might as well have something I guess even if it's awkward, it would be nice to have something progressive but something like res.add('ETag', 'whatever') is a little lame. I'll merge this for now for parity with node I can see people expecting it anyway, thanks man

tj added a commit that referenced this pull request Jan 24, 2013
Allow setting an array of header values in the response
@tj tj merged commit 57cda15 into expressjs:master Jan 24, 2013
@gmethvin gmethvin deleted the set_array branch January 24, 2013 04:37
rlidwka pushed a commit to rlidwka/express that referenced this pull request Aug 6, 2014
Allow setting an array of header values in the response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

response.set is incorrect when trying to set multiple values for a header
2 participants