const myRequest = new Request("flowers.jpg");
const myHeaders = myRequest.headers; // Headers {}Request: headers property / notebook
Request: headers property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const myHeaders = new Headers();
myHeaders.append("Content-Type", "image/jpeg");
const myInit = {
method: "GET",
headers: myHeaders,
mode: "cors",
cache: "default",
};
const myRequest = new Request("flowers.jpg", myInit);
const myContentType = myRequest.headers.get("Content-Type"); // returns 'image/jpeg'