Ways to make a request in Chrome Dev Tools
Snippet
Written with a loving hand by kitt some time around 07:13 on 17 April 2019
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