I am currently utilizing the library isomorphic-unfetch
to retrieve JSON data from a Rest API. Here is my approach for making the request:
const res = await fetch(
`url`
);
To extract the body, I simply do:
const response = await res.json()
However, I am unsure about how to access the response headers. When I log the response to my server's console, this is the information displayed:
Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
// stuff
},
[Symbol(Response internals)]: {
url: 'request url',
status: 200,
statusText: 'OK',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}
I am curious about the Symbol(Response internals)
and how I can access its headers
property. Can anyone assist me with this?