-
-
Notifications
You must be signed in to change notification settings - Fork 688
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Bug Description
Undici's request function appears to be skipping headers that are constructed using the Headers global object.
Reproducible By
- Create an instance of
Headersclass. - Add header with set/append.
- Pass headers instance to request.
const headers = new Headers()
headers.append('random-header', 'hello world')
const res = await request('http://localhost:3001', { headers })Full reproducable example can be found in following repo
Expected Behavior
I expect the undici.request function to treat instances of the Headers 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
{
host: 'localhost:3000',
connection: 'keep-alive',
'random-header': 'hello world' // passed as plain object
}
{ host: 'localhost:3001', connection: 'keep-alive' } // as Headers instance
Environment
OS: Windows 10
Nodejs: v20.8.0
undici: v6.6.1
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request