git commands« an older post
a newer one »JetBrains IDE shortcuts

Ways to make a request in Chrome Dev Tools

Snippet

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

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.