-
-
Notifications
You must be signed in to change notification settings - Fork 664
fix: handle Headers in RedirectHandler #3777
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,9 +227,10 @@ function cleanRequestHeaders (headers, removeContent, unknownOrigin) { | |
} | ||
} | ||
} else if (headers && typeof headers === 'object') { | ||
for (const key of Object.keys(headers)) { | ||
const entries = headers instanceof Headers ? headers.entries() : Object.entries(headers) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this won't work for Maps, only Headers There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe better to check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iiAku can you create a follow up PR? const entries = utils.isIterable(headers) ? headers : Object.entries(headers) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this also only works with the global Headers, not Headers imported from undici There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes I can look into this, thanks for reviewing raising that point @KhafraDev |
||
for (const [key, value] of entries) { | ||
if (!shouldRemoveHeader(key, removeContent, unknownOrigin)) { | ||
ret.push(key, headers[key]) | ||
ret.push(key, value) | ||
} | ||
} | ||
} else { | ||
|
Uh oh!
There was an error while loading. Please reload this page.