블로그를 이전하였습니다. 2023년 11월부터 https://bluemiv.github.io/에서 블로그를 운영하려고 합니다. 앞으로 해당 블로그의 댓글은 읽지 못할 수 도 있으니 양해바랍니다.
반응형
HTTPie는 기존 curl과 같이 HTTP 요청을 보낼때 사용하는 CLI 기반의 툴이다.

설치 방법
설치 방법은 공식 사이트에 가면 친절히 설명되어있다.
HTTPie – command-line HTTP client for the API era
CLI HTTP that will make you smile. JSON and sessions support, syntax highlighting, wget-like downloads, plugins, and more.
httpie.io
Homebrew를 이용하여 설치하는 방법을 소개하면,
아래와 같이 명령어를 수행한다.
$ brew install httpie
설치 후 아래와 같이 명령어를 수행하여, 버전이 나오면 정상적으로 설치가 된것이다.
$ http --version
2.3.0
사용방법
사용방법을 간단히 소개하면
http <옵션> <메소드> <주소> <키=값> 과 같은 형태로 보낼 수 있다.
예를들면,
$ http -v GET httpbin.org/get
GET /get HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: httpbin.org
User-Agent: HTTPie/2.3.0
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 297
Content-Type: application/json
Date: Tue, 01 Dec 2020 23:18:06 GMT
Server: gunicorn/19.9.0
{
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Host": "httpbin.org",
"User-Agent": "HTTPie/2.3.0",
"X-Amzn-Trace-Id": "Root=1-5fc6cf2e-1bc143b4554f73c74e2343fd"
},
"origin": "121.168.215.76",
"url": "http://httpbin.org/get"
}
$ http -f POST httpbin.org/post hello=World
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 487
Content-Type: application/json
Date: Tue, 01 Dec 2020 23:19:14 GMT
Server: gunicorn/19.9.0
{
"args": {},
"data": "",
"files": {},
"form": {
"hello": "World"
},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Content-Length": "11",
"Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
"Host": "httpbin.org",
"User-Agent": "HTTPie/2.3.0",
"X-Amzn-Trace-Id": "Root=1-5fc6cf72-47c56c415932fa741879cc0c"
},
"json": null,
"origin": "121.168.215.76",
"url": "http://httpbin.org/post"
}
반응형
'ETC' 카테고리의 다른 글
| MacOSX 에 ElasticSearch 설치하기 (Homebrew 사용) (0) | 2021.01.22 |
|---|---|
| Git 계정 변경, fatal: Authentication failed for (0) | 2021.01.19 |
| vscode 설정값 초기화하기 (settings.json) (0) | 2020.11.05 |
| 카카오 AdFit 연동하기 (Tistory 블로그) (0) | 2020.10.30 |
| 객체 지향 프로그래밍이란? (Object Oriented Programming) (0) | 2020.09.08 |