Curl to Code Converter — Chuyển Curl Sang 14 Ngôn Ngữ
Chuyển lệnh curl phức tạp sang code 14 ngôn ngữ: JavaScript (fetch), Node.js, Axios, Python requests, Go net/http, Java, PHP, Ruby, Rust reqwest, C# HttpClient, Elixir, Dart, Swift, Kotlin. Dùng curlconverter — chuẩn industry.
Vì sao dùng tool này
Copy curl từ Postman / browser DevTools / API docs → paste → chọn fetch hoặc Python hoặc Go, có code ngay không cần học library.
Authorization header, cookies, multipart form data, JSON body — convert đầy đủ, không miss.
Curl thường chứa token Bearer / API key. Tool 100% client-side, không upload curl lên server.
Cách sử dụng
- 1Copy curl command từ Postman 'Export → curl' hoặc Chrome DevTools 'Copy as curl'.
- 2Chọn target ngôn ngữ (fetch / axios / python / go / ...).
- 3Bấm Convert → có code ready để paste vào project.
Curl Converter — Why
Curl là lingua franca cho HTTP debugging — API docs hay show curl example, browser DevTools 'Copy as curl' cho request bất kỳ. Nhưng dev cần code thật để integrate. Convert thủ công 1 curl phức tạp với 10 headers + multipart body sang Python/Go tốn 15 phút, dễ miss field.
Tool dùng curlconverter — npm package được dùng làm engine cho curlconverter.com (tool gốc). Parse curl thành intermediate representation rồi generate code idiomatic cho từng ngôn ngữ: Python dùng requests, Go dùng net/http với context, Rust dùng reqwest async, JavaScript dùng modern fetch (không phải XMLHttpRequest).
- ✓14 target languages
- ✓fetch / axios / requests / net-http / reqwest / HttpClient ...
- ✓Multipart form-data support
- ✓JSON body + headers + cookies
- ✓Auth Basic + Bearer preserve
- ✓100% client-side
Câu hỏi thường gặp
Có convert được curl phức tạp với --data-binary, --form, --cookie không?
Có. curlconverter parse đầy đủ flag thường dùng. Một số flag rare (--cert, --capath, --proxy) parse có thể giới hạn.
Output Python có phải dùng requests library?
Đúng. requests là Python HTTP client phổ biến nhất. Phase 2 sẽ add httpx (async modern alternative).
Sao không thấy target Erlang / OCaml?
curlconverter có ~25 target, tool list 14 phổ biến. Cần thêm liên hệ qua issue.