티스토리 뷰
728x90
🧾 curl 주요 옵션 정리
📡 1. 기본 요청
curl http://example.com
- 기본 GET 요청을 보냄
🔁 2. HTTP 메서드 지정
curl -X POST http://example.com
curl -X PUT http://example.com
- -X를 이용해 HTTP 메서드 설정
📤 3. 데이터 전송 (POST/PUT 등)
curl -d "key=value&key2=value2" http://example.com
curl -d '{"json":"data"}' -H "Content-Type: application/json" http://example.com
- -d: 데이터 전송
- -H: 헤더 설정
🧾 4. 헤더 추가
curl -H "Authorization: Bearer token" http://example.com
curl -H "Content-Type: application/json" http://example.com
💾 5. 응답 저장
curl -o output.txt http://example.com
- -o: 응답을 파일로 저장
⏱️ 6. 타임아웃 설정
curl --connect-timeout 3 --max-time 5 http://example.com
- --connect-timeout: 연결 시도 최대 시간 (초)
- --max-time: 전체 요청/응답 최대 시간 (초)
🔒 7. HTTPS 인증서 무시 (테스트용)
curl -k https://example.com
- -k 또는 --insecure: 인증서 검증 생략 (위험, 테스트용)
📂 8. 파일 업로드 (멀티파트)
curl -F "file=@/path/to/file.txt" http://example.com/upload
- -F: 멀티파트 form 데이터 전송
📥 9. 리디렉션 자동 추적
curl -L http://example.com
- -L: 3xx 리디렉션 자동 따라감
🧪 10. 응답 코드 확인
curl -s -o /dev/null -w "%{http_code}" http://example.com
- -s: silent 모드 (진행률 등 숨김)
- -o /dev/null: 응답 내용 버림
- -w "%{http_code}": HTTP 상태 코드만 출력
728x90
'기타' 카테고리의 다른 글
Kafka Connect 커스텀 SMT - JSON 데이터 외부 API POST 호출 + MongoDB Sink Connector (0) | 2025.04.12 |
---|---|
Kafka Connect 기반 Base64 이미지 자동 저장 설계 (0) | 2025.04.11 |
Apache APISIX 로 API Gateway(Spring Cloud Gateway) 대체 (0) | 2025.03.31 |
RabbitMQ → Kafka 직접 치환 (0) | 2025.03.31 |
Kafka Proxy란? (0) | 2025.03.31 |