Answers for "js fetch send headers"

4

javascript fetch headers

fetch('https://example.com/profile', {
  method: 'POST', // or 'PUT'
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(data),
})
.then(response => response.json())
.then(data => {
  console.log('Success:', data);
})
.catch((error) => {
  console.error('Error:', error);
});
Posted by: Guest on June-10-2021
0

fetch post headers

method:"POST",
body:JSON.stringify(data),
 headers:{
      "content-type": "application/json"
  }
Posted by: Guest on July-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language