-
-
Notifications
You must be signed in to change notification settings - Fork 133
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(ClientRequest): prevent rawHeaders
from being shared across instances
#694
Conversation
@@ -118,7 +118,7 @@ export function recordRawFetchHeaders() { | |||
[Reflect.get(headersInit, kRawHeaders)], | |||
newTarget | |||
) | |||
ensureRawHeadersSymbol(headers, Reflect.get(headersInit, kRawHeaders)) | |||
ensureRawHeadersSymbol(headers, [...Reflect.get(headersInit, kRawHeaders)]) |
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.
It would be great to add a @note
comment here explaining that spreading the headers creates their copy + what issue this prevents.
@@ -241,3 +241,15 @@ it('does not throw on using Headers before recording', () => { | |||
request.headers.set('X-My-Header', '1') | |||
expect(getRawFetchHeaders(request.headers)).toEqual([['X-My-Header', '1']]) | |||
}) | |||
|
|||
it('does not use the same instance of rawHeaders', async () => { |
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.
rawHeaders
inclusion in the name is probably not needed. How about
it('isolates the headers on the instance basis')
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.
I also like linking GitHub issues above the test case names so it's easier to grasp the context for bug fixes.
rawHeaders
from being shared across instances
Released: v0.37.4 🎉This has been released in v0.37.4! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
fixes #681