1
0
mirror of https://github.com/httpie/cli.git synced 2024-11-28 08:38:44 +02:00

Add --compress documentation (#1173)

* Add --compress documentation

* Apply suggestions from code review

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Update docs/README.md

* Update docs/README.md

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
This commit is contained in:
Mickaël Schoentgen 2021-10-08 18:38:40 +02:00 committed by GitHub
parent 6befaf9067
commit ab8512f96c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1304,7 +1304,8 @@ The universal method for passing request data is through redirected `stdin`
By default, `stdin` data is buffered and then with no further processing used as the request body.
If you provide `Content-Length`, then the request body is streamed without buffering.
You may also use `--chunked` to enable streaming via [chunked transfer encoding](#chunked-transfer-encoding).
You may also use `--chunked` to enable streaming via [chunked transfer encoding](#chunked-transfer-encoding)
or `--compress, -x` to [compress the request body](#compressed-request-body).
There are multiple useful ways to use piping:
@ -1414,6 +1415,24 @@ $ http --chunked pie.dev/post @files/data.xml
$ cat files/data.xml | http --chunked pie.dev/post
```
## Compressed request body
You can use the `--compress, -x` flag to instruct HTTPie to use `Content-Encoding: deflate` and compress the request data:
```bash
$ http --compress pie.dev/post @files/data.xml
```
```bash
$ cat files/data.xml | http --compress pie.dev/post
```
If compressing the data does not save size, HTTPie sends it untouched. To always compress the data, specify `--compress, -x` twice:
```bash
$ http -xx PUT pie.dev/put hello=world
```
## Terminal output
HTTPie does several things by default in order to make its terminal output easy to read.