Post
EN

curl option 관련

curl의 document 는 아래 경로이다.

https://curl.se/docs/manpage.html

curl - How To Use

curl / Docs / Tool / Man Page curl.1 the man page Related: File a bug about this man page Manual FAQ HTTP Scripting Name curl - transfer a URL Synopsis curl [options / URLs] Description curl is a tool for transferring data from or to a server. It supports these protocols: DICT, FILE, FTP, FTPS, GOPH…

내가 이것을 왜 찾게 되었냐면 curl의 -w 옵션으로 특정 값을 가져올 수 있다고하여, 어떤 포멧이 있는지 살펴봤다.

가령 아래와 같이 커멘드 라인에 입력하면 응답 결과와 http status code로 획득할 수 있다.

curl <http://localhost:8080/product-composite/213> -s -w "%{http_code}"
{"productId":213,"name":"name-213","weight":123,"recommendations":[{"recommendationId":1,"author":"Author 1","rate":1},{"recommendationId":2,"author":"Author 2","rate":2},{"recommendationId":3,"author":"Author 3","rate":3}],"reviews":[],"serviceAddresses":{"cmp":"f7fe7abdc755/172.28.0.5:8080","pro":"8f6d4c653c73/172.28.0.4:8080","rev":"","rec":"81ebd258fc2e/172.28.0.3:8080"}}200

현재 책을 읽으면서 보고 있는데 bash shell script로도 많은 재미난 테스트를 할 수 있는 것 같다.

This article is licensed under CC BY 4.0 by the author.