Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

특징

httpie 는 python 으로 개발된 콘솔용 http client 유틸리티로 curl 대신 http 개발 및 디버깅 용도로 사용 가능하며 다음과 같은 특징이 있다.

  1. curl 에 비해 사용이 쉬움
  2. json 지원 기능 내장
  3. 출력을 포맷팅하여 보여주므로 가독성이 뛰어남
  4. Form 과 file 업로드가 쉬움
  5. HTTP 인증 및 커스텀 헤더 설정등

 

설치

python  으로 개발되었으므로 yum 이나 apt-get 보다는 pip 로 설치하는 것을 권장한다.

  1. pip 설치

    wget https://bootstrap.pypa.io/get-pip.py
    python get-pip.py
  2. httpie 설치

    pip install --upgrade httpie

기본 사용

http [flags] [METHOD] URL [ITEM [ITEM]]
  • flags 
  • METHOD : HTTP 메소드로 생략시 GET.
  • URL: 연결할 url

 

기본 연결

 http  httpie.org

 

자세한 정보 출력

-v 옵션 사용

http -v httpie.org

 

follow redirect

--follow 옵션을 사용하면 HTTP 301, 302 응답이 올 경우 해당 링크로 이동

http -v --follow http://httpie.org

 

HTTP Header

To set custom headers you can use the Header:Value notation:

http example.org  User-Agent:Bacon/1.0  'Cookie:valued-visitor=yes;foo=bar'  \
    Accept:application/json Referer:http://httpie.org/


HTTP Authentication

--auth, 또는 -a 옵션 뒤에 인증 정보를 전달
http -a username:password example.org

암호를 커맨드에 전달하지 않을 경우 프롬프트에서 입력

http -a username example.org

 

Digest auth:

 http --auth-type=digest -a username:password example.org

 

Ref

 

  • No labels