2016-02-28 10:17:45 +00:00
|
|
|
# http
|
|
|
|
|
2020-02-17 14:22:19 +00:00
|
|
|
> HTTPie: HTTP client, aims to be easier to use than cURL.
|
2019-06-07 11:58:30 +01:00
|
|
|
> More information: <https://httpie.org>.
|
2016-02-28 10:17:45 +00:00
|
|
|
|
|
|
|
- Download a URL to a file:
|
|
|
|
|
2021-05-04 08:25:21 +01:00
|
|
|
`http --download {{example.org}}`
|
2016-02-28 10:17:45 +00:00
|
|
|
|
|
|
|
- Send form-encoded data:
|
|
|
|
|
2021-05-04 08:25:21 +01:00
|
|
|
`http --form {{example.org}} {{name='bob'}} {{profile_picture@'bob.png'}}`
|
2016-02-28 10:17:45 +00:00
|
|
|
|
|
|
|
- Send JSON object:
|
|
|
|
|
|
|
|
`http {{example.org}} {{name='bob'}}`
|
|
|
|
|
|
|
|
- Specify an HTTP method:
|
|
|
|
|
|
|
|
`http {{HEAD}} {{example.org}}`
|
|
|
|
|
|
|
|
- Include an extra header:
|
|
|
|
|
|
|
|
`http {{example.org}} {{X-MyHeader:123}}`
|
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Pass a username and password for server authentication:
|
2016-02-28 10:17:45 +00:00
|
|
|
|
2021-05-04 08:25:21 +01:00
|
|
|
`http --auth {{username:password}} {{example.org}}`
|
2016-02-29 09:47:42 +00:00
|
|
|
|
2022-12-04 07:53:34 +00:00
|
|
|
- Specify raw request body via `stdin`:
|
2016-02-29 09:47:42 +00:00
|
|
|
|
2016-10-21 16:56:02 +01:00
|
|
|
`cat {{data.txt}} | http PUT {{example.org}}`
|