HTTP Request to Code
Turn a raw HTTP request into curl, fetch, axios, Python requests, Go, PHP cURL, HTTPie or wget code in your browser. Method, headers and body are kept.
What this http request to code does
The request line, headers and body are parsed once and each target is generated from that structure, so the language cannot silently drop a header the others keep. The URL is taken from the request line when it is absolute, otherwise from the Host header, and the page says so rather than inventing a host.
How to use it
HTTP Request to Code: paste the raw HTTP request into the box above, set Target language (default "curl"), and press Run to get the code below.
Worked example
Input:
POST /api/items HTTP/1.1
Host: api.example.com
Content-Type: application/json
Authorization: Bearer token123
{"name":"widget"}
Output:
curl -X POST 'https://api.example.com/api/items' \
-H 'Host: api.example.com' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer token123' \
--data-raw '{"name":"widget"}'
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads raw HTTP request and returns code; reloading the page discards both.
The request line, headers and body are parsed once and each target is generated from that structure, so the language cannot silently drop a header the others keep. The URL is taken from the request line when it is absolute, otherwise from the Host header, and the page says so rather than inventing a host.
Turn a raw HTTP request into curl, fetch, axios, Python requests, Go, PHP cURL, HTTPie or wget code in your browser. Method, headers and body are kept.
How to use it
HTTP Request to Code: paste the raw HTTP request into the box above, set Target language (default "curl"), and press Run to get the code below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads raw HTTP request and returns code; reloading the page discards both.
What to Expect
Best for
- Converting raw HTTP request to code when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
POST /api/items HTTP/1.1 Host: api.example.com Content-Type: application/json Authorization: Bearer token123 {"name":"widget"}
Sample output
curl -X POST 'https://api.example.com/api/items' \ -H 'Host: api.example.com' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer token123' \ --data-raw '{"name":"widget"}'
Frequently asked questions
How do I use the http request to code?
HTTP Request to Code: paste the raw HTTP request into the box above, set Target language (default "curl"), and press Run to get the code below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.