Ways to make a request in Chrome Dev Tools
Snippet
Instead of being asleep at 07:13 on 17 April 2019, kitt created this:
You're in a browser, you want to make a server request (say, logout), without having to figure out the headers and such.
// GET fetch('https://toronado.local:8443/api/v1/logout') .then(res => res.json()) .then(console.log) // POST fetch('https://toronado.local:8443/api/v1/search', { method: 'POST', body: JSON.stringify({ term: 'foo', limit: 1 }), headers: { 'Content-type': 'application/json; charset=UTF-8' } }) .then(res => res.json()) .then(console.log) // Imagine the others!
Add new comment