Paste a curl command and get the same request as fetch, Axios, Python requests, PHP Guzzle, PHP cURL, Go or HTTPie code.
Headers and parts3 of 3 included
Untick anything you don't want in the code, such as cookies.
const response = await fetch("https://api.example.com/v1/orders", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
"item": "coffee",
"quantity": 2,
"gift": false
}),
redirect: "manual",
})
const data = await response.text()
console.log(data)
Paste a curl command, such as one copied from your browser's Network tab (right-click a request, then Copy as cURL), and pick the language you want. It handles headers, JSON and form bodies, file uploads, basic auth, cookies and redirects.
curl does not follow redirects unless you pass -L, so the generated code switches redirects off to behave the same way. Things that cannot be converted, like shell variables or files read from disk, are listed under the code.
Everything happens in your browser, so tokens and URLs in the command are not sent anywhere.