From c50dd87a58443e4a61861f337bf8b2f0120ff35d Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Mon, 4 Sep 2017 09:33:44 +0800 Subject: [PATCH] httpie: update --- httpie.md | 77 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/httpie.md b/httpie.md index f096a0489..4d1954e4f 100644 --- a/httpie.md +++ b/httpie.md @@ -1,52 +1,73 @@ --- title: httpie category: CLI -layout: default-ad +layout: 2017/sheet +weight: -3 +updated: 2017-09-04 --- - $ http POST example.com/posts/3 \ - Origin:example.com # : HTTP headers - name="John Doe" \ # = string - q=="search" \ # == URL parameters (?q=search) - age:=29 \ # := for non-strings - list:='[1,3,4]' # := json - file@file.bin \ # @ attach file - token=@token.txt \ # =@ read from file (text) - user:=@user.json \ # :=@ read from file (json) +### Parameters + +```bash +$ http POST example.com/posts/3 \ + Origin:example.com # : HTTP headers + name="John Doe" \ # = string + q=="search" \ # == URL parameters (?q=search) + age:=29 \ # := for non-strings + list:='[1,3,4]' # := json + file@file.bin \ # @ attach file + token=@token.txt \ # =@ read from file (text) + user:=@user.json \ # :=@ read from file (json) +``` ### Forms - $ http --form POST example.com \ - name="John Smith" \ - cv=@document.txt +```bash +$ http --form POST example.com \ + name="John Smith" \ + cv=@document.txt +``` ### Options - --pretty=none # all,colors,format +Print options: +{: .-setup} - --print=HBhb - # H : request headers - # B : request body - # h : response headers - # b : response body +```bash +-v, --verbose # same as --print=HhBb + --print=HhBb # H: request headers + # B: request body + # h: response headers + # b: response body + --pretty=none # all | colors | format +``` - -v, --verbose # same as --print=HhBb +Authentication: - -o, --output FILE +```bash + --session NAME +-a, --auth USER:PASS + --auth-type basic + --auth-type digest +``` - --follow - --timeout SECONDS - --verify no # skip SSL verification +Downloading: +```bash --download --continue +-o, --output FILE +``` - --session NAME - --auth USER:PASS (or -a) - --auth-type {basic,digest} +Others: +```bash + --follow # follow redirects + --timeout SECONDS + --verify no # skip SSL verification --proxy http:http://foo.bar:3128 +``` ### References - * https://github.com/jakubroztocil/httpie +*