cURL → 코드
curl 명령을 붙여 넣으면 JavaScript fetch, TypeScript, Axios, Python requests, Go, C#, Java, Rust 코드로 바꿔 줍니다. 쿼리 파라미터, 헤더, JSON·멀티파트 본문을 그대로 유지합니다.
브라우저 안에서만 실행됩니다. 입력한 내용은 어디에도 업로드되지 않습니다.
- Method
- POST
- Base URL
- https://api.example.com/v1/orders
Content-Typeapplication/jsonAcceptapplication/json
{"customer_id":"cus_1042","items":[{"sku":"SOFT-01","qty":2}],"currency":"USD"}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 관련 문법 가이드
Node.js 가이드 전체Node.js JWT invalid signature: JWKS Rotation and Clock Skew
One message covers three bugs: the wrong key type for RS256 or ES256, a JWKS cache that never refreshes after a kid rotation, and a clock that drifted.
Node.jsERR_REQUIRE_ESM and __dirname Is Not Defined in ESM Projects
require of an ESM-only package has nothing to load, and ESM creates none of the CommonJS wrapper globals. Dynamic import, createRequire, and the path replacements.
Node.jsNode.js fetch ETIMEDOUT and SELF_SIGNED_CERT_IN_CHAIN Debugging
fetch failed hides everything in error.cause. Read the aggregate, trust the private CA the way curl does, route the proxy, and set the connect timeout undici does not.
Node.jsNode.js JavaScript heap out of memory: Snapshots and Real Leaks
Distinguish needs more from leaks before raising the flag: external memory and heap tell different stories, and a heap ceiling at three quarters of the container limit keeps V8 able to report.