Skip to content

Keep original letter case of response header keys#1098

Merged
jcrugzz merged 3 commits intohttp-party:masterfrom
pachirel:keep-header-case
Dec 2, 2016
Merged

Keep original letter case of response header keys#1098
jcrugzz merged 3 commits intohttp-party:masterfrom
pachirel:keep-header-case

Conversation

@pachirel
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread lib/http-proxy/passes/web-outgoing.js Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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