cURL to Axios
Turn a cURL command into a JavaScript Axios request.
Local
This tool needs JavaScript enabled to run in your browser.
What this tool does
This tool turns a cURL command into an Axios request in JavaScript. Paste a command, including one copied from your browser devtools, and it writes the matching axios call with the method, URL, headers, query parameters and body.
How it maps to Axios
- The method and URL go in the config object.
- Headers go in
headers; query parameters go inparams. - A JSON body goes in
dataas an object; form data usesURLSearchParams. - Basic auth from
-ubecomes theauthoption.
Good to know
The snippet uses top-level await, so run it in an async function or a module. It only reads the command and writes code in your browser; it never sends the request.
Frequently asked questions
- Does it send the request?
- No. It reads the cURL command and writes the Axios code in your browser. Nothing is sent.
- How is the body handled?
- JSON becomes a data object, form data uses URLSearchParams, and basic auth becomes the auth option.
Learning resources
Testsmith also runs hands-on courses and a free practice app for the skills behind this tool.
Testsmith Online Courses
Improve your API testing skills
Design, run and automate API checks step by step.
API Spector
Send live requests with API Spector
A free, local-first API client built by Testsmith for real request/response work.
Practice Software Testing
Practise API testing against a real API
A documented REST API you can hit for free.