-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[BUGFIX] Lowercase header names in parseResponseHeaders #5489
Conversation
7afa0ea
to
312d7e0
Compare
let field = header | ||
.substring(0, j) | ||
.trim() | ||
.toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you also mind adding the original "unlowercased" field name to the headers object so anyone's app that is relying the the current behavior continues to work?
312d7e0
to
a4df4e1
Compare
@bmac feedback addressed! |
@bmac I feel per-spec we should deprecate the non-lower-cased version in a follow-up, unsure how to implement and probably needs an RFC, otherwise mega +1 on this |
@@ -92,7 +94,7 @@ test('ignores headers that do not contain a colon', function(assert) { | |||
|
|||
let headers = parseResponseHeaders(headersString); | |||
|
|||
assert.deepEqual(headers['Content-Encoding'], 'gzip', 'parses basic header pair'); | |||
assert.deepEqual(headers['content-encoding'], 'gzip', 'parses basic header pair'); | |||
assert.deepEqual(headers['apple'], 'pie', 'parses basic header pair'); | |||
assert.equal(Object.keys(headers).length, 2, 'only has the one valid header'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert's description is wrong (we had two and now we have three valid headers lol). The valid headers will be content-encoding
Content-Encoding
and apple
Oh whoops yep, I glossed over the fact that this changes the tests I
updated too 👌🏼
Will address.
…On Mon, Jul 23, 2018 at 10:55 PM Chris Thoburn ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In tests/unit/utils/parse-response-headers-test.js
<#5489 (comment)>:
> @@ -92,7 +94,7 @@ test('ignores headers that do not contain a colon', function(assert) {
let headers = parseResponseHeaders(headersString);
- assert.deepEqual(headers['Content-Encoding'], 'gzip', 'parses basic header pair');
+ assert.deepEqual(headers['content-encoding'], 'gzip', 'parses basic header pair');
assert.deepEqual(headers['apple'], 'pie', 'parses basic header pair');
assert.equal(Object.keys(headers).length, 2, 'only has the one valid header');
This assert's description is wrong (we had two and now we have three valid
headers lol). The valid headers will be content-encoding Content-Encoding
and apple
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5489 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEmHihqxePO8hzRLyWii5BEnN6sFAWYjks5uJoytgaJpZM4UoICC>
.
|
a4df4e1
to
db9946a
Compare
Anddddd we're back, should be good now @runspired |
Closes #4952.
Pretty sure I got all the places we rely on uppercased header names, like in
generatedDetailedMessage
🤞