Last active
April 24, 2019 17:55
-
-
Save mattlockyer/6e1dff34962b0c47e84c3eca414e266e to your computer and use it in GitHub Desktop.
JSON POST from console
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
fetch('http://localhost:8080/test', { | |
method: 'POST', | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({name:'matt', number:34}), | |
// optional | |
// mode: "cors", // no-cors, cors, *same-origin | |
// cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached | |
// credentials: "same-origin", // include, *same-origin, omit | |
// redirect: "follow", // manual, *follow, error | |
// referrer: "no-referrer", // no-referrer, *client | |
}).then((res) => res.json()).then((res) => console.log(res)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment