Skip to content

Instantly share code, notes, and snippets.

@alanmquach
Created April 22, 2020 02:12
Show Gist options
  • Save alanmquach/4084a0c251728a0fbddc091e395e70ce to your computer and use it in GitHub Desktop.
Save alanmquach/4084a0c251728a0fbddc091e395e70ce to your computer and use it in GitHub Desktop.
POST JSON using fetch
const post = (url, body) => fetch(url, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify(body)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment