Skip to content

Commit ab8512f

Browse files
BoboTiGjkbrzt
andauthored
Add --compress documentation (#1173)
* Add --compress documentation * Apply suggestions from code review Co-authored-by: Jakub Roztocil <[email protected]> * Update docs/README.md * Update docs/README.md Co-authored-by: Jakub Roztocil <[email protected]>
1 parent 6befaf9 commit ab8512f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,8 @@ The universal method for passing request data is through redirected `stdin`
13041304
13051305
By default, `stdin` data is buffered and then with no further processing used as the request body.
13061306
If you provide `Content-Length`, then the request body is streamed without buffering.
1307-
You may also use `--chunked` to enable streaming via [chunked transfer encoding](#chunked-transfer-encoding).
1307+
You may also use `--chunked` to enable streaming via [chunked transfer encoding](#chunked-transfer-encoding)
1308+
or `--compress, -x` to [compress the request body](#compressed-request-body).
13081309
13091310
There are multiple useful ways to use piping:
13101311
@@ -1414,6 +1415,24 @@ $ http --chunked pie.dev/post @files/data.xml
14141415
$ cat files/data.xml | http --chunked pie.dev/post
14151416
```
14161417
1418+
## Compressed request body
1419+
1420+
You can use the `--compress, -x` flag to instruct HTTPie to use `Content-Encoding: deflate` and compress the request data:
1421+
1422+
```bash
1423+
$ http --compress pie.dev/post @files/data.xml
1424+
```
1425+
1426+
```bash
1427+
$ cat files/data.xml | http --compress pie.dev/post
1428+
```
1429+
1430+
If compressing the data does not save size, HTTPie sends it untouched. To always compress the data, specify `--compress, -x` twice:
1431+
1432+
```bash
1433+
$ http -xx PUT pie.dev/put hello=world
1434+
```
1435+
14171436
## Terminal output
14181437
14191438
HTTPie does several things by default in order to make its terminal output easy to read.

0 commit comments

Comments
 (0)