간단한 Command-line HTTP 클라이언트, Httpie

2020. 7. 19. 11:53위키

HTTPie

HTTPie 는 Command-line 으로 동작하는 정말 간단하고 쉬운 HTTP 클라이언트에요. HTTP 클라이언트는 HTTP 프로토콜을 사용해서 서버와 데이터를 주고 받는 친구들이에요.

 

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.org

설치도 간단해요. 저는 brew 를 이용해서 설치했어요.

$ brew install httpie
 

Homebrew

The Missing Package Manager for macOS (or Linux).

brew.sh

근데 brew 가 없거나 싫다면 파이썬 설치 패키지인 pip 를 이용해서 설치할 수도 있어요.

$ pip install --upgrade httpie

--version 을 했을 때 버전이 제대로 나오면 잘 된 거에요.

$ http --version

혹시 잘 안되면 설치없이 온라인으로도 할 수 있어요.

 

HTTPie demo

Try HTTPie in your browser.

httpie.org

 

HTTPie 사용법

먼저 네이버와 데이터를 주고 받을 거에요. get 메서드로 네이버 홈페이지를 가져올 수 있어요.

$ http get https://www.naver.com

 

로컬에서 돌아가는 서버와 데이터를 주고 받을 수도 있어요. 만약 localhost:3000 에서 나의 어플리케이션이 돌아가고 있다면 포트번호만 써줘요.

$ http get :3000

get 말고 post, put, delete 메서드를 사용할 수도 있어요. 이건 여기에 정말 잘 정리되어 있어요.

 

HTTPie 2.2.0 (latest) documentation

CLI HTTP that will make you smile. JSON and sessions support, syntax highlighting, wget-like downloads, plugins, and more.

httpie.org