Re: [whatwg/fetch] Use case for Headers getAll (#973)

> FWIW, using `getAll` would maintain consistency with other Web APIs such as [URLSearchParams.getAll()](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/getAll). It's also what is being used by Cloudflare Workers as @kentonv mentioned above.
> 
> I think `getSetCookie` is just fine - this comment is more to call out API consistency.

`getAll` was removed from the specifications because Webkit objected to it, since it would not be feasible for them to implement. As I see it, the only options for bringing `getAll` back would be:
- Allowing browsers to optionally combine all headers but `Set-Cookie`. This would introduce implementation-defined behavior, which isn't a good practice for things like this. It would also be impossible to effectively communicate to the user that this difference is intentional.
- Mandating that all headers must be combined, with the single exception of `Set-Cookie`. This would mean the semantics of this method would be different from the previously defined `getAll` method. Furthermore, if server-side implementations like Cloudflare Workers switched to it, the change would be much harder to debug than just removing the method.

In my opinion, both of these options are bad, and `getSetCookie` is much better than either.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/973#issuecomment-1412755450
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/973/1412755450@github.com>

Received on Wednesday, 1 February 2023 21:30:36 UTC