cURL to Playwright
Turn a cURL command into a Playwright API test in TypeScript.
This tool needs JavaScript enabled to run in your browser.
What this tool does
This tool turns a cURL command into a Playwright API test in TypeScript. It reads the request and writes a test that uses Playwright's request fixture to send the call and assert the response, ready to drop into a Playwright project.
How it maps to Playwright
- The method becomes the matching request method, such as
request.post. - Headers go in the
headersoption; query parameters go inparams. - A JSON body goes in
dataas an object, which Playwright sends as JSON. - A form body goes in
form; a raw body goes indataas a string. - Multipart fields go in
multipart, with file fields usingfs.createReadStream.
Good to know
The generated test asserts response.ok() and logs the JSON body, as a starting point. Replace that with the assertions your case needs. Basic auth from -u is written as an Authorization header; for repeated use you may prefer Playwright's httpCredentials at the context level. Playwright's API testing runs without a browser, so these tests are fast and stable.
Common use cases
- Starting an API test from a request you captured in devtools.
- Adding an API check alongside your browser end-to-end tests.
- Reproducing a reported request exactly inside your test suite.
Frequently asked questions
- Does it run the request?
- No. It only reads the cURL command and writes the matching Playwright code in your browser. It never sends the request.
- Which bodies are supported?
- JSON becomes the data option, form data becomes the form option, and multipart fields become the multipart option. File uploads use fs.createReadStream.
Learning resources
Testsmith also runs hands-on courses and a free practice app for the skills behind this tool.