tldr/pages/common/http.md

33 lines
667 B
Markdown
Raw Normal View History

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}}`
- 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}}`
- Specify raw request body via `stdin`:
`cat {{data.txt}} | http PUT {{example.org}}`