I am using the Fetch API to create an HTTP request.
fetch(url, options)
.then(response =>
console.log(...response.headers.keys()));
But I see from Chrome that there are more headers in the incoming HTTP response (Date, Server, Transfer-Encoding, X-foo). Why can't I see them in the output for the above code?
I start Chrome with the following flags:
C:\path\chrome.exe --disable-web-security --user-data-dir=C:\path\tmp\chrome
Answer:
body: (...)
bodyUsed: false
headers: Headers
ok: true
status: 200
statusText: "OK"
type: "cors"
url: "http://origin?query"
I note that executing a non-CORS request saves headers. Does CORS separate them?
body: (...)
bodyUsed: false
headers: Headers
ok: true
status: 200
statusText: "OK"
type: "basic"
url: "http://origin?query"
source
share