Skip to content

Instantly share code, notes, and snippets.

@cjkoepke
Last active July 26, 2017 03:50
Show Gist options
  • Save cjkoepke/0d76c26e5d87c1a0f1dad94edb388063 to your computer and use it in GitHub Desktop.
Save cjkoepke/0d76c26e5d87c1a0f1dad94edb388063 to your computer and use it in GitHub Desktop.
A simple way to add headers to a fetch call.
const myHeaders = new Headers();
myHeaders.append('Content-Type', 'document');
fetch('url-here', {
method: 'GET',
headers: myHeaders
}).then(res => {
// Do something.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment