본문으로 건너뛰기

cURL Converter

cURL 명령어를 JavaScript (Fetch, Axios), Python 등 다양한 프로그래밍 언어 코드로 변환하는 도구입니다.

cURL Command

Code Output

Converted code will appear here...

주요 기능

  • 4가지 출력 형식 지원 (Fetch API, Axios, JavaScript Async/Await, Python requests)
  • HTTP 메서드 자동 감지 (GET, POST, PUT, DELETE 등)
  • 헤더 및 바디 파싱
  • 인증 토큰 자동 변환
  • 4가지 예제 템플릿

지원 형식

Fetch API

fetch('https://api.example.com/users', {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: '{"name":"John"}'
})

Axios

axios({
method: 'post',
url: 'https://api.example.com/users',
headers: {
"Content-Type": "application/json"
},
data: '{"name":"John"}'
})

JavaScript (Async/Await)

const postRequest = async () => {
const response = await fetch('https://api.example.com/users', {
method: 'POST',
body: '{"name":"John"}'
});
return await response.json();
};

Python requests

import requests

url = 'https://api.example.com/users'
data = {'name':'John'}
response = requests.post(url, json=data)

사용 사례

브라우저 DevTools에서 복사

# Chrome DevTools Network 탭에서 "Copy as cURL" → 붙여넣기
curl 'https://api.example.com/data' -H 'Authorization: Bearer token'

Postman 요청 변환

# Postman에서 Code 버튼 → cURL 복사 → 변환

API 문서 코드 생성

# API 문서의 cURL 예제 → 원하는 언어로 변환

활용 팁

  1. 빠른 프로토타이핑: API 테스트 후 즉시 코드로 변환
  2. 언어 전환: 다른 언어로 API 클라이언트 작성 시 참고
  3. 학습 도구: cURL 명령어를 통해 HTTP 요청 구조 이해
  4. 문서 작성: 여러 언어의 예제 코드 생성

관련 도구