Request Headers
Send Accept / Content-Type and read response headers.
Headers are metadata on the request or response. Common request headers:
Accept (what you want back) and Content-Type
(what you are sending). Pass them in the second argument to
fetch. Response headers are read with
response.headers.get(…).
Header details appear here.
Important JavaScript
const response = await fetch(url, {
headers: {
Accept: "application/json"
}
});
const type = response.headers.get("content-type");