Javascript: Fetch POST JSON

PHOTO EMBED

Mon Aug 29 2022 21:05:48 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #javascript

(async () => {
  const rawResponse = await fetch('https://httpbin.org/post', {
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({a: 1, b: 'Textual content'})
  });
  const content = await rawResponse.json();

  console.log(content);
})();
content_copyCOPY