-
Notifications
You must be signed in to change notification settings - Fork 25.7k
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
fix(http): preserve header case when copying headers #12697
Conversation
876d81a
to
3acec37
Compare
I think the fix should be if (headers instanceof Headers) {
headers._headers.forEach((values: string[], name: string) => {
values.forEach(value => this.append(name, value));
});
return;
} -> if (headers instanceof Headers) {
headers.forEach((values: string[], name: string) => {
values.forEach(value => this.append(name, value));
});
return;
} (removing |
@vicb updated with your suggested simplification |
headers.set('fOo', 'baz'); | ||
headers.set('foo', 'bat'); | ||
headers = new Headers(headers); | ||
expect(JSON.stringify(headers)).toEqual('{"fOo":["bat"]}'); |
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.
expect(JSON.stringify(new Headers(headers))).toEqual('{"fOo":["bat"]}');
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.
Done.
Can't wait for this to get pulled. |
This issue persists. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
#12106 attempted to preserve the case of HTTP headers added to the
Headers
object.It failed, because
StaticRequest
copies the headers (angular/modules/@angular/http/src/static_request.ts
Line 97 in 69f006c
angular/modules/@angular/http/src/headers.ts
Line 52 in 69f006c
What is the new behavior?
Copying headers preserves their case.
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information: