httpie: update

This commit is contained in:
Rico Sta. Cruz 2017-09-04 09:33:44 +08:00
parent dd9f82752d
commit c50dd87a58
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 49 additions and 28 deletions

View File

@ -1,52 +1,73 @@
--- ---
title: httpie title: httpie
category: CLI category: CLI
layout: default-ad layout: 2017/sheet
weight: -3
updated: 2017-09-04
--- ---
$ http POST example.com/posts/3 \ ### Parameters
Origin:example.com # : HTTP headers
name="John Doe" \ # = string ```bash
q=="search" \ # == URL parameters (?q=search) $ http POST example.com/posts/3 \
age:=29 \ # := for non-strings Origin:example.com # : HTTP headers
list:='[1,3,4]' # := json name="John Doe" \ # = string
file@file.bin \ # @ attach file q=="search" \ # == URL parameters (?q=search)
token=@token.txt \ # =@ read from file (text) age:=29 \ # := for non-strings
user:=@user.json \ # :=@ read from file (json) 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 ### Forms
$ http --form POST example.com \ ```bash
name="John Smith" \ $ http --form POST example.com \
cv=@document.txt name="John Smith" \
cv=@document.txt
```
### Options ### Options
--pretty=none # all,colors,format Print options:
{: .-setup}
--print=HBhb ```bash
# H : request headers -v, --verbose # same as --print=HhBb
# B : request body --print=HhBb # H: request headers
# h : response headers # B: request body
# b : response 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 Downloading:
--timeout SECONDS
--verify no # skip SSL verification
```bash
--download --download
--continue --continue
-o, --output FILE
```
--session NAME Others:
--auth USER:PASS (or -a)
--auth-type {basic,digest}
```bash
--follow # follow redirects
--timeout SECONDS
--verify no # skip SSL verification
--proxy http:http://foo.bar:3128 --proxy http:http://foo.bar:3128
```
### References ### References
* https://github.com/jakubroztocil/httpie * <https://github.com/jakubroztocil/httpie>