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.

Send Accept and inspect Content-Type on the response.

Important JavaScript

const response = await fetch(url, {
  headers: {
    Accept: "application/json"
  }
});

const type = response.headers.get("content-type");