-
Notifications
You must be signed in to change notification settings - Fork 600
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
Issue with undici.request and Headers Global Object #2700
Comments
As we can see here https://github.com/nodejs/undici/blob/main/lib/core/request.js#L159-L174 request constructor expects only |
Headers object are not expected to work. Though I wouldn't mind adding support for it. PR welcome. |
I would like to implement it. |
it might be worth it to allow Map-like objects instead (ie. something that implements .get()/an iterator) instead of only Headers. |
Good idea. Would it be a sufficient to implement it like it's done in fetch? (check for symbol.iterator) Lines 573 to 576 in 8e14078
|
Bug Description
Undici's
request
function appears to be skipping headers that are constructed using theHeaders
global object.Reproducible By
Headers
class.Full reproducable example can be found in following repo
Expected Behavior
I expect the
undici.request
function to treat instances of theHeaders
class the same way it handles plain JavaScript objects passed to options.Specifically, I anticipate that the headers, when constructed using the
Headers
class, should be seamlessly attached to the HTTP request.Logs & Screenshots
Environment
OS: Windows 10
Nodejs: v20.8.0
undici: v6.6.1
The text was updated successfully, but these errors were encountered: