cURL → Fetch/Axios

HTTP-requests converteren vanuit cURL

cURL

Fetch

await fetch("https://api.example.com/v1/items", {
  method: "POST",
  headers: {
  "Content-Type": "application/json",
  "Authorization": "Bearer TOKEN",
},
  body: "{name:Test}",
});

Axios

await axios({
  url: "https://api.example.com/v1/items",
  method: "post",
  headers: {
  "Content-Type": "application/json",
  "Authorization": "Bearer TOKEN",
},
  data: "{name:Test}",
});