페이지

주제

도구

↑↓이동↵열기esc닫기
인코딩 · 보안

cURL → 코드

curl 명령을 붙여 넣으면 JavaScript fetch, TypeScript, Axios, Python requests, Go, C#, Java, Rust 코드로 바꿔 줍니다. 쿼리 파라미터, 헤더, JSON·멀티파트 본문을 그대로 유지합니다.

브라우저 안에서만 실행됩니다. 입력한 내용은 어디에도 업로드되지 않습니다.

출력 언어
Presets
1줄
POST2 headers0 query params본문 79바이트
Parsed request쿼리 0 · 헤더 2 · 폼 0
Method
POST
Base URL
https://api.example.com/v1/orders
Headers
  • Content-Typeapplication/json
  • Acceptapplication/json
Body
{"customer_id":"cus_1042","items":[{"sku":"SOFT-01","qty":2}],"currency":"USD"}
실시간
JavaScript · fetch
531자 · 26줄
const options = {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
  body: JSON.stringify({
    "customer_id": "cus_1042",
    "items": [
      {
        "sku": "SOFT-01",
        "qty": 2
      }
    ],
    "currency": "USD"
  }),
};

const response = await fetch("https://api.example.com/v1/orders", options);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}

const data = await response.json();
console.log(data);

Query params, headers and multipart fields stay intact in every language; HEAD requests print the status and headers instead of parsing a body, and a non-ASCII Basic auth pair is encoded as UTF-8. Flags without an equivalent — output files, proxies, retries — are reported on the left instead of being dropped silently.

curl 플래그 치트시트

빠른 참조
-X POST
메서드를 지정합니다. curl은 -d 본문이 있으면 이미 POST로 보내므로, -X는 PUT, PATCH, DELETE에만 필요합니다.
-H 'Content-Type: application/json'
헤더마다 -H를 반복합니다. Content-Type이 없으면 서버는 JSON 본문을 폼 데이터나 일반 텍스트로 처리합니다.
-d '{"a":1}' / --data-raw
-d는 줄바꿈을 지우고 본문을 인코딩합니다. --data-raw는 그대로 보내므로 JSON에는 이쪽이 맞습니다.
-u user:pass
HTTP 기본 인증입니다. user:pass를 base64로 인코딩해 Authorization 헤더에 넣으므로 HTTPS에서만 안전합니다.
--json '{"a":1}'
curl 7.82 이상의 축약형입니다. 본문을 보내면서 POST로 바꾸고, Content-Type과 Accept: application/json이 없으면 자동으로 붙입니다.
-F 'file=@photo.png;type=image/png'
멀티파트 업로드입니다. @는 파일을 읽고, ;type은 콘텐츠 타입을 지정하며, name=value 형태는 일반 텍스트 필드가 됩니다.
Node.js 가이드 전체