-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to access raw headers #1437
Comments
The current headers implementation would need an overhaul to support this. It stores headers as strings, rather than arrays (which I believe goes against the spec) and doesn't concat values when using I can see adding edit: It looks like undici only needs to store |
Some more additional context, it looks like Deno's implementation is also a bit different: Deno:
Node:
Not sure what the "right" thing to do is, just pointing out an implementation detail. I've been looking at creating an http server library that translates node's http.IncomingMessage to a |
Undici is the spec-compliant way, Deno purposefully doesn't concatenate |
Right, they seem to do that because they reuse the Request and Response classes in a server context, not just for usage with fetch. If that's not a goal of undici, then it should probably just stick with the spec. |
Deno most likely does this just because it's better for the user; otherwise the array of set-cookie headers wouldn't be exposed. |
I think this can be closed now that |
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.raw
method that returns entries for each (including duplicate) header.Headers.prototype.getAll
to return multiple header values.I have also considered...
Additional context
.raw()
implementationThe text was updated successfully, but these errors were encountered: