-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
I found a peculiar issue of incompatibility of this library comparing to native browser fetch version. Affected version 2.6.0
Steps to reproduce:
1.) Create simple node server and run it
const http = require('http');
const requestListener = function (req, res) {
res.setHeader('Cookie', ['one=1', 'two=2']);
res.setHeader('Content-Type', ['text/plain', 'application/json']);
res.writeHead(200);
res.end('Hello, World!');
}
const server = http.createServer(requestListener);
server.listen(8080);2.) Fetch the server
In browser
fetch('http://localhost:8080').then(r => r.headers).then(h => h.get('Content-Type')).then(console.dir);
// text/plain, application/jsonnode-fetch
fetch('http://localhost:8080').then(r => r.headers).then(h => h.get('Content-Type')).then(console.dir);
// text/plainAs you can see, node-fetch doesn't correctly handle multiple headers with the same name.
Reactions are currently unavailable