This would solve...
As outlined at WHATWG/fetch there is often the need in a server environment to access cookie headers.
For example editing Cookie headers:
const h = new Headers;
h.append("Set-Cookie", "a=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT");
h.append("Set-Cookie", "b=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT");
h.get("Set-Cookie")
// a=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT, b=1; Expires=Wed, 21 Oct 2015 07:28:00 GMT
Splitting the combined header value by , will give an invalid result. Instead getAll could be used to retrieve the individual headers.
The implementation should look like...
There are two solutions currently proposed:
- Node-fetch provides a non-standard
Headers.prototype.raw method that returns entries for each (including duplicate) header.
- Re-introduce
Headers.prototype.getAll to return multiple header values.
I have also considered...
- Not use undici primitives within NodeJS.
- Attempt to monkey patch undici
Additional context
- Cloudflare implemented .getAll().
- Node-fetch
.raw() implementation
- Tracking at WinterCG
This would solve...
As outlined at WHATWG/fetch there is often the need in a server environment to access cookie headers.
For example editing Cookie headers:
Splitting the combined header value by , will give an invalid result. Instead getAll could be used to retrieve the individual headers.
The implementation should look like...
There are two solutions currently proposed:
Headers.prototype.rawmethod that returns entries for each (including duplicate) header.Headers.prototype.getAllto return multiple header values.I have also considered...
Additional context
.raw()implementation