Toolvist

Conversor de cURL a fetch

Convierte un comando cURL en código JavaScript fetch, Axios, Python requests o Go con un solo pegado. Conversor cURL a código para cuatro lenguajes.

Paste a curl command, including multi-line ones.

Target language

Método

—

Encabezados

0

Body

—

Auth

—

Conversor de cURL a fetch

Pega un comando cURL y obtén código equivalente en JavaScript fetch, Axios, Python requests, Go o PHP. Las cabeceras, los métodos, los cuerpos JSON, los datos de formulario, el basic auth y las cookies se traducen todos.

The reverse translation is the Curl Command Builder, and the related client-side translator is the Postman to Fetch Converter. To inspect what the converted request returns, the HTTP Header Checker reads the response.

Cómo usar cURL a fetch

  1. 1 Paste your curl command.
  2. 2 Choose fetch or another target.
  3. 3 Convert. Flags become request options and headers become an object.
  4. 4 Check the notes for flags that have no direct equivalent.

Cómo usarlo

Copia una petición desde el "Copy as cURL" de las DevTools de tu navegador o desde la documentación de una API, pégala arriba y elige tu lenguaje de destino. El analizador entiende el entrecomillado, los caracteres escapados y las continuaciones de línea, así que los comandos multilínea funcionan tal cual.

  • Salida fetch, Axios, Python, Go y PHP
  • Maneja -X, -H, -d, --data-raw, -u, -F y -b
  • Cuerpos JSON convertidos a objetos nativos
  • Datos de formulario y peticiones multipart
  • Copia cualquier lenguaje con un clic

Preguntas frecuentes

How do basic auth flags translate?

The credential flags produce an authorization header with a base64-encoded pair. The generated code usually emits that header explicitly rather than using a fetch option, since not all targets support the option. Be careful not to paste a real credential into a shared codebase.

Why does the converted request fail in the browser?

Because curl has none of the browser's restrictions. Cross-origin requests need the server to permit them, cookies are handled differently, and certain headers cannot be set from browser code at all. A curl command that works from a terminal may be impossible to reproduce exactly in a page.

What happens to output flags?

They have no equivalent, because fetch returns a response object rather than writing bytes somewhere. Saving to a file becomes reading the response body and handling it as a blob or text. That transformation is semantic rather than mechanical, and it has to be done deliberately.

Herramientas para desarrolladores relacionadas

Ver todo en Herramientas para desarrolladores →

También te puede interesar

Herramientas de otras categorías que suelen combinarse con cURL a fetch:

Explorar el directorio completo →