fix: handle Headers in RedirectHandler#3777
Conversation
e4ddac9 to
c1c78c2
Compare
b941ad4 to
71c9baf
Compare
lib/handler/redirect-handler.js
Outdated
| } | ||
|
|
||
| module.exports = RedirectHandler | ||
| module.exports.cleanRequestHeaders = cleanRequestHeaders |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Added tests in appropriate file
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.
this won't work for Maps, only Headers
There was a problem hiding this comment.
maybe better to check for Symbol.Iterable
There was a problem hiding this comment.
@iiAku can you create a follow up PR?
const entries = utils.isIterable(headers) ? headers : Object.entries(headers)There was a problem hiding this comment.
this also only works with the global Headers, not Headers imported from undici
There was a problem hiding this comment.
@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
This relates to...
This should close #3773
Rationale
Changes
Features
Bug Fixes
Breaking Changes and Deprecations
Status