-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathhttpie.cli.txt
165 lines (134 loc) · 8.71 KB
/
httpie.cli.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
┏━━━━━━━━━━━━┓
┃ HTTPIE ┃
┗━━━━━━━━━━━━┛
VERSION ==> #3.2.4
#CLI HTTP[S]/1.1 client
FEATURES ==> #HTTP:
# - headers: Host [C], User-Agent: HTTPie/* [C], Accept-Encoding [C], Accept: */* [C],
# Connection: keep-alive [C], Content-Type [C], Content-Length [C]
# - JSON, x-www-form-urlencoded, multipart/form-data request body
# - gzip|deflate in response body
# - cookies
# - Authentication: Basic, Digest
# - redirects
#File downloads
#Responses streaming
#Proxy
CONFIG ==> #Can use:
# - ~/.httpie/config.json
# - ENVVAR HTTPIE_CONFIG_DIR/config.json
#The file has "default_options" '--OPT'_ARR key
┌──────────┐
│ MAIN │
└──────────┘
http [--OPTS] [METHOD] URL
[QUERY_VAR==VAL ...]
[HEADER:VAL,... ...]
[BODY_VARR=STR|@PATH ...] #Default METHOD: GET if no BODY_VAR, POST otherwise
[JSON_BODY_VARR:=VAL|@PATH ...] #URL can be ":[PORT]" for "localhost[:PORT]"
[FORM_BODY_VAR@PATH ...] #PATH can be PATH;type=MIME
#VARR can be:
# - VAR[VAR2|NUM][...]
# - VAR[]: append
--raw=STR #Request body
STDIN ==> #Can also be used for request body
#Buffered unless Content-Type [C] is specified or FORM_BODY_VAR@PATH
--ignore-stdin #Ignore stdin for request body
--default-scheme=SCHEME #Def: 'http'
--json #Serialize BODY to JSON and use Accept: application/json, */*;q=0.5 [C],
#Content-Type: application/json [C]
#Is set by default
--form #Serialize BODY to either:
# - Content-Type: application/x-www-form-urlencoded; charset=utf-8 [C]
# - Content-Type: multipart/form-data; boundary=BOUNDARY [C]
# if any FORM_BODY_VAR@PATH was used
--multipart #Serialize BODY to Content-Type: multipart/form-data; boundary=BOUNDARY [C]
--boundary=STR #multipart/form-data BOUNDARY (def: random ID)
--chunked #Use Transfer-Encoding: chunked [C]
--output FILE #Like >FILE
--download #Like --output FILE but:
# - only prints response body
# - guess FILE (unless --output used) using Content-Disposition [S] or URL + Content-Type [S]
--continue #With --download and --output, resume interrupted download
#Only if server uses byte serving (Range [S])
--offline #Dry run
--path-as-is #Do not normalize URL path
┌──────────────┐
│ BEHAVIOR │
└──────────────┘
--follow #Follow redirects
--max-redirects=NUM #Def: 30
--max-headers=NUM #Def: 0
--timeout=NUM #Connection timeout. Def: 30 (in secs)
--check-status #Without it, exit code is 1 if network|fatal error
#With it, also exit code:
# - 2: request timed out
# - 3: response status code 3** and no --follow
# - 4|5: response status code 4**|5**
# - 6: --max-redirects
# - 7: plugin errors
┌────────────┐
│ OUTPUT │
└────────────┘
--stream #Stream the response instead of printing it all at once
--all #Print intermediary requests (redirects, authentication intermediary requests, etc.)
--print=CHAR... #What to print among H (request header), B (request body), h (response header), b (response body), m (elapsed time)
#Def is "hb"
--headers #Same as --print=h
--body #Same as --print=b
--meta #Same as --print=m
--verbose #Same as --all --print=HBhb
--quiet|q #Same as --print=
#If done twice, suppress warnings
--pretty=all|colors|format|none #Whether to format (ident and sort keys) and add colors (def: 'all')
--style=STYLE #Color scheme (def: 'auto'). I like 'monokai'
--format-options=OPT:VAL,... #Available OPTs:
# - headers.sort BOOL (def: true)
# - json.sort_keys BOOL (def: true)
# - json.indent NUM (def: 4)
# - json.format BOOL (def: true)
# - xml.indent NUM (def: 2)
# - xml.format BOOL (def: false)
--[un]sorted #Like --format-options=headers.sort + json.sort_keys
--response-charset=CHARSET #
--response-mime=MIME #
┌───────────────────┐
│ HTTP FEATURES │
└───────────────────┘
--compress|-x #HTTP compression of request body with Deflate
--session[-read-only]= #Saves and reuses cookies, auth credentials and custom request headers to file
PATH.json|NAME #NAME will save under ~/.httpie/sessions/NAME.json
--auth=CREDENTIALS #
--auth-type=basic|digest|bearer #Def: 'basic'
--auth-type=netrc #
--auth-type=oauth1 ##Package 'httpie-oauth' (1.0.0)
--auth-type=zign ##Package 'httpie-zign' (0.2)
##OAuth 2
--auth-type=jwt ##Package 'httpie-jwt-auth' (0.3.0)
##CREDENTIALS is token (def: ENVVAR JWT_AUTH_TOKEN)
##Can change prefix with ENVVAR JWT_AUTH_PREFIX (def: 'Bearer')
--auth-type=hmac ##Package 'httpie-hmac-auth' (0.2.3)
--auth-type=api-auth ##Package 'httpie-api-auth' (0.3.0)
##HMAC-based
--auth-type=aws ##Package 'httpie-aws-auth' (0.0.3)
##CREDENTIALS is "ACCESSKEY:SECRETKEY"
##Can also use AWS ENVVARs
--auth-type=aws-auth4 ##Package 'httpie-aws-authv4' (0.1.2)
--auth-type=ntlm ##Package 'httpie-ntlm' (1.0.0)
--ignore-netrc #Do not read .netrc for credentials
--proxy=SCHEME:URL #Can also use ENVVARs HTTP[S]_PROXY=URL, NO_PROXY=HOST,... and ALL_PROXY
--verify=false|true|FILE #SSL server authentication (def: 'yes')
#FILE is CA_BUNDLE file. Can also use ENVVAR REQUESTS_CA_BUNDLE
--ssl=ssl2.3|tls1|tls1.1|tls1.2|
tls1.3 #Def: highest possible
--ciphers=CIPHER,... #
--cert=FILE
--cert-key=FILE
--cert-key-pass=STR #Client authentication
┌─────────────┐
│ PLUGINS │
└─────────────┘
CONF.plugin_dir #Def: CONF's dir
http cli plugins [un]install NAME #
http cli plugins upgrade NAME #
http cli plugins list #