About the cURL to Axios
The command is read the way a shell reads it: single and double quotes, backslash escapes, ANSI-C strings ($'…', used by Chrome and Firefox in “Copy as cURL” for bodies with line breaks or quotes), line continuations, and the ^ escapes of “Copy as cURL (cmd)” on Windows. The options are then interpreted like curl does: -d makes the request a POST with the content type application/x-www-form-urlencoded, several -d are joined with &, --data-urlencode percent-encodes its value, -G moves the data into the query string, --json sets the Content-Type and Accept headers, -F builds a multipart form, -u becomes HTTP Basic authentication and -I a HEAD request.
The options map to the axios request config: headers to headers, -u user:password to auth, --max-time to timeout in milliseconds, -x to proxy, --max-redirs to maxRedirects, and -k to an https.Agent with rejectUnauthorized: false for Node.js. A JSON body is passed as a plain object — axios serializes it — when that produces the same data; a form body becomes URLSearchParams, and -F becomes FormData. When a body must be sent byte for byte, for example JSON with numbers beyond 253, it stays a string and a transformRequest keeps axios from re-encoding it.
Two differences from curl are worth knowing. axios rejects the promise for any status outside 200–299, while curl prints the error response and exits with 0 unless --fail is given; set validateStatus to change that. And axios follows up to 21 redirects in Node.js (the browser decides on its own), while curl follows none without -L. Options without an equivalent — client certificates, --resolve, retries — are listed under the code instead of being dropped silently. The same converter also writes fetch, XMLHttpRequest and Python requests code; nothing is uploaded.
How to use it
- Paste a curl command, for example from the developer tools: Network → Copy → Copy as cURL.
- Keep axios as the target, or switch to fetch, XMLHttpRequest or Python requests.
- Choose async/await or promise .then() style.
- Check the warnings and notes under the code, then copy it into your project (npm install axios).