2017-12-20 11:51:32 +08:00
|
|
|
# httpie
|
|
|
|
|
2021-05-20 16:13:41 -04:00
|
|
|
> A user friendly command-line HTTP tool.
|
2021-09-02 15:33:49 -03:00
|
|
|
> More information: <https://github.com/httpie/httpie>.
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-20 20:27:08 +08:00
|
|
|
- Send a GET request (default method with no request data):
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-22 09:27:22 +05:30
|
|
|
`http {{https://example.com}}`
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-20 20:27:08 +08:00
|
|
|
- Send a POST request (default method with request data):
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-22 09:27:22 +05:30
|
|
|
`http {{https://example.com}} {{hello=World}}`
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-20 20:27:08 +08:00
|
|
|
- Send a POST request with redirected input:
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-22 09:27:22 +05:30
|
|
|
`http {{https://example.com}} < {{file.json}}`
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Send a PUT request with a given JSON body:
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-22 09:27:22 +05:30
|
|
|
`http PUT {{https://example.com/todos/7}} {{hello=world}}`
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-22 09:27:22 +05:30
|
|
|
- Send a DELETE request with a given request header:
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-22 09:27:22 +05:30
|
|
|
`http DELETE {{https://example.com/todos/7}} {{API-Key:foo}}`
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-20 20:27:08 +08:00
|
|
|
- Show the whole HTTP exchange (both request and response):
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-22 09:27:22 +05:30
|
|
|
`http -v {{https://example.com}}`
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-20 20:27:08 +08:00
|
|
|
- Download a file:
|
2017-12-20 11:51:32 +08:00
|
|
|
|
2017-12-22 09:27:22 +05:30
|
|
|
`http --download {{https://example.com}}`
|