Closed lyricsboy closed 1 year ago
I'm realizing this might be better raised as an issue for node-fetch, since this library tries to stay in sync with that API. Thoughts?
It looks like there's ongoing work there to replace the Headers class with fetch-headers
(which will hopefully implement getSetCookie
soon) https://github.com/node-fetch/node-fetch/pull/1484
I will close this issue and watch that space.
We are using minipass-fetch via make-fetch-happen in our implementation of apollo-gateway. Our downstream GraphQL services may return cookies in their response headers via the set-cookie header. According to the HTTP/Cookies spec, this header can appear multiple times in the response.
In the current implementation of Headers,
get
returns a comma-separated list of the values for a given header, and this is the only way (that I can see) to access those values. In a gateway/proxy kind of application, the downstream headers should be able to be passed through to the outgoing response without modification or combination. Specifically with cookies, we have seen issues where the combined comma-separated list of cookies is interpreted differently by browsers when attributes like HttpOnly are included in some of them.The Fetch Standard defines a special method on Headers, getSetCookie, which is designed to handle this use case.
It would be nice if this implementation supported that method. As a workaround, we are using the
raw()
method of Headers to access the array-value for set-cookie from the map, but we would prefer not to rely on internals.