Strange result with `set-cookie` header of `undici.fetch`
See original GitHub issueBug Description
Result of set-cookie, Set-cookie, and sEt-CoOkIe header value should be same, but undici.fetch has different result.
Reproducible By
const { fetch } = require('undici');
const response = await fetch('https://maple.gg');
console.log(response.headers); // has set-cookie
console.log(response.headers.get('set-cookie')); // undefined
console.log(response.headers.get('Set-cookie')); // some cookie key and value
console.log(response.headers.get('sEt-CoOkIe')); // some cookie key and value
Expected Behavior
I think all result of get should be same.
Logs & Screenshots
Environment
Ubuntu 20.04 Node v16.14.2
Additional context
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Fetch API with Cookie - Stack Overflow
Programmatically overwriting Cookie header in browser side won't work. In fetch documentation, Note that some names are forbidden. is mentioned ...
Read more >Fetch API has landed into Node.js - Hacker News
In undici this will succeed but with res.status 0 and no headers, ... If more than one of the same header is set...
Read more >How to securely call an authenticated API from your front end
Your front end needs to access data from an API which requires an API key. How can you keep it safe and do...
Read more >Using cookie retrieved with HTTP Retriever node doesn't work ...
WARN HTTP Retriever 3:932 Invalid cookie header: "Set-Cookie: ... You can get them with the HTTP Result Data Extractor: ... V strange.
Read more >fetch vs beacon - compare differences and reviews? | LibHunt
Many HTTP response headers, like etags, are typically computed by buffering the response, running some compute, then sending headers and the buffered body....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
set-cookie
is a forbidden header-name so it should be removed entirely (this is similar behavior with browser)however
getting
a non-existent header should return null, not undefined.edit: fixed both bugs and will make a PR soon.
Reverted? Probably not. However I’m willing to make a PR once a decision has been made on how to handle cookies in undici/node.