-
-
Notifications
You must be signed in to change notification settings - Fork 663
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
Unable to use headers of type [string, string][]
, using Record<string, string>
works (see below).
Reproducible By
import http from "node:http";
import { Agent, interceptors, request } from "undici";
const port = process.env.PORT ?? 3001;
const { cache, dns } = interceptors;
const good = new Agent().compose(cache());
const fail = new Agent().compose(cache(), dns());
http
.createServer((req, res) => {
console.log(req.headers);
res.end();
})
.listen(port, async () => {
const headers = [["foo", "bar"]];
await request(`http://localhost:${port}`, {
dispatcher: good,
headers,
});
await request(`http://localhost:${port}`, {
dispatcher: fail,
headers,
});
const headersAsRecord = { foo: "bar" };
await request(`http://localhost:${port}`, {
dispatcher: fail,
headers: headersAsRecord,
});
});
node index.js
{ host: 'localhost:3001', connection: 'keep-alive', foo: 'bar' }
{ '0': 'foo, bar', host: 'localhost:3001', connection: 'keep-alive' }
{ host: 'localhost:3001', connection: 'keep-alive', foo: 'bar' }
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working