-
-
Notifications
You must be signed in to change notification settings - Fork 688
Add support for passing iterable objects as headers #2708
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
Conversation
|
Hey @ronag and @KhafraDev, I've got a pull request up that I'd appreciate your eyes on. Your feedback would be incredibly helpful! |
mcollina
left a comment
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.
lgtm
as far as I recall, Headers had some special handling logic for cookies. Can you check that everything works correctly with those?
Thank you for noticing potencial issue, will check it out. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2708 +/- ##
==========================================
- Coverage 85.54% 85.29% -0.26%
==========================================
Files 76 84 +8
Lines 6858 7591 +733
==========================================
+ Hits 5867 6475 +608
- Misses 991 1116 +125 ☔ View full report in Codecov by Sentry. |
What I've found is const headers = new Headers()
headers.append('Set-Cookie', 'key=value')
headers.append('Set-Cookie', 'key2=value2')
for (const [key, value] of headers) {
console.log(key, value) // will print one cookie per row
}
console.log(headers.getSetCookie()) // will return list of cookiesShould I look for any other potential issues with cookies? |
metcoder95
left a comment
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.
Nice 🚀
LGTM
Co-authored-by: Mert Can Altın <[email protected]>
Co-authored-by: Mert Can Altın <[email protected]>
mertcanaltin
left a comment
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.
LGTM! 🚀
mcollina
left a comment
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.
lgtm
|
Hi, we got a bug report that seems strongly related to this change. I generally think it is a good change, however, the thought struck me that this might have been a breaking change (at least in combination with |
|
I traced this a bit more and recognized it as related to this PR: I think this PR is just related to the chain of updates. |
|
Is there a minimal repro for the issue? It should be fixed on our end. |
|
@KhafraDev What I am referring to is not really a bug, so I am not sure it can be fixed. I am simply saying that this change should potentially have gone into a Node.js major. But looking at the situation again, Node.js 20 still seems to be on undici 5 so was probably a bit too eager to comment here. As long as this feature is only lands in Node as part of a major, everything is fine. Sorry for the distraction! |
|
I would consider a breaking change in a minor release of undici to be a bug. If you provide a minimal repro I'd be willing to take a look. |
|
@KhafraDev here's a simple repro demonstrating the change that occurred between 6.6.2 and 6.7.0. |
This relates to
Resolves #2700
Rationale
Improve flexibility and user expirience by allowing directly passing iterable objects as headers to
undici.request.It will add support for Headers, Maps and custom objects with Symbol.iterator that yields the key-value pairs.
Changes
Features
Bug Fixes
N/A
Breaking Changes and Deprecations
N/A
Status