Last active
July 26, 2017 03:50
-
-
Save cjkoepke/0d76c26e5d87c1a0f1dad94edb388063 to your computer and use it in GitHub Desktop.
A simple way to add headers to a fetch call.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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