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

Keep original letter case of response header keys #1098

Merged
merged 3 commits into from
Dec 2, 2016

Conversation

pachirel
Copy link
Contributor

@pachirel pachirel commented Dec 1, 2016

This PR fixes the issue #1029

In RFC, HTTP header key is case-insensitive (ref: nodejs/node-v0.x-archive#1954).
But, proxy server should care not to change the original request unintentionally ✨

Copy link
Contributor

@jcrugzz jcrugzz left a comment

Choose a reason for hiding this comment

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

Overall this seems reasonable, just DRY it up a little bit

for (var i = 0; i < proxyRes.rawHeaders.length; i += 2) {
var key = proxyRes.rawHeaders[i];
var header = proxyRes.rawHeaders[i + 1];
if (header != undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we put this duplicate logic in a function we call with key and header?

function setHeader(key, header) {}

@pachirel
Copy link
Contributor Author

pachirel commented Dec 2, 2016

@jcrugzz Thank you for your quick response 😄 I fixed.

@jcrugzz jcrugzz merged commit 4edbb62 into http-party:master Dec 2, 2016
@jcrugzz
Copy link
Contributor

jcrugzz commented Dec 2, 2016

thanks!

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.

2 participants