Skip to content
Tools

cURL to Playwright

Turn a cURL command into a Playwright API test in TypeScript.

Local
Playwright (TypeScript)

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 headers option; query parameters go in params.
  • A JSON body goes in data as an object, which Playwright sends as JSON.
  • A form body goes in form; a raw body goes in data as a string.
  • Multipart fields go in multipart, with file fields using fs.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.

Feedback welcome

Found a bug in this tool, or want it to do something it does not? Tell us and we will take a look.