[whatwg/fetch] Either expose HTTP Header to Javascript or expose the cookies to fetch API's response (Issue #1947)

peperronii created an issue (whatwg/fetch#1947)

### What problem are you trying to solve?

Right now there are two main ways to attach arbitrary data to a HTTP response

1.  a custom HTTP Header
2. a Cookie

However, we can neither access the current page header via javascript nor read the cookies from a fetch response. That means when we build the logic for the server, if I want to send an arbritary data outside of the body of the response and intend to use it in a per Request Basis, It is very awkward to do so.

And even though the cookie from a fetch response via document.cookie but if there are many fetch request happening in a page it would either face race conditions or unneccessarily populate cookie names for each fetch site and/or request

Therefore, We should have a unified way to send some data apart from the body of the response that can be read by both the page request and the fetch request.

### What solutions exist today?

Right now, the backend logic would have to seperate the fetch request from the normal page request, and choose to send the data in the corresponding format.

- Cookie for a normal request
- Header for a fetch request

OR 

Send both at the same time.

### How would you solve it?

Either expose HTTP Header to Javascript runtime or expose response cookies to fetch API

### Anything else?

_No response_

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

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

Received on Monday, 17 August 2026 10:36:06 UTC