GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — fix: handle Headers in RedirectHandler by iiAku · Pull Request #3777 · nodejs/undici Conversation
|
| } | ||
|
|
||
| module.exports = RedirectHandler | ||
| module.exports.cleanRequestHeaders = cleanRequestHeaders |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Let's not do that if we are just exporting it to testing it out.
You can attempt to test the same on the redirect-request test suite where you submit a Headers instance instead of the array/object way.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Added tests in appropriate file
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
7c891d5 to
e4768c4
Compare
| } | ||
| } 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.
The reason will be displayed to describe this comment to others. Learn more.
this won't work for Maps, only Headers
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
maybe better to check for Symbol.Iterable
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The 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)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The 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)
Yes I can look into this, thanks for reviewing raising that point @KhafraDev
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
RedirectHandler cleans headers too aggressively
There was an error while loading. Please reload this page.