Skip to content

Instantly share code, notes, and snippets.

@bennycode
Created February 18, 2019 23:19
Show Gist options
  • Save bennycode/ed95ed9edd6ce0d04e7c8d6e6eb1a1f8 to your computer and use it in GitHub Desktop.
Save bennycode/ed95ed9edd6ce0d04e7c8d6e6eb1a1f8 to your computer and use it in GitHub Desktop.
Send POST request in Google Chrome
// Using "var" here to easily change the parameters and resubmit the code in a JS dev console!
var url = 'http://127.0.0.1:3000/login';
var parameters = {
user: 'bennyn',
password: 'secret'
};
fetch(url, {
method: 'post',
body: JSON.stringify(parameters)
})
.then((response) => response.json())
.then(console.log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment