Re: [whatwg/fetch] Trailer support in the API (#981)

Given the mutable nature of the `Headers` object, it may be possible to support trailers without any new APIs. Considering trailers are just delayed headers, would adding them to `Response.headers` right before ending the body stream not make sense? This way there is no need for a separate event or promise, the `done` flag of the body stream reader should be sufficient.

Applications that insist on making a distinction may compare the headers before and after the body stream is consumed, or just assume that every header listed in the `trailers` header is a trailer. Aside of the implementation of trailers in frameworks that need to generate requests or responses (i.e. browsers themselves, for `fetch` or `FetchEvent.respondWith`) I'm not aware of consumer use-cases where this distinction is necessary. That's also why I'm surprised by the above-quoted caching rfc9111.

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

Message ID: <whatwg/fetch/issues/981/1775663151@github.com>

Received on Monday, 23 October 2023 17:22:05 UTC