1
0
mirror of https://github.com/httpie/cli.git synced 2025-07-17 01:42:46 +02:00

Tweak response meta docs

- expand response meta section
- add examples
- interlink sections
This commit is contained in:
Jakub Roztocil
2022-01-23 14:35:20 +01:00
parent 2797b7244c
commit caa8fb9058

View File

@ -1442,7 +1442,7 @@ be printed via several options:
```bash ```bash
$ http --print=Hh PUT pie.dev/put hello=world $ http --print=Hh PUT pie.dev/put hello=world
``` ```
#### Response meta #### Response meta
@ -1454,12 +1454,12 @@ All the other [output options](#output-options) are under the hood just shortcut
```bash ```bash
$ http --meta pie.dev/delay/1 $ http --meta pie.dev/delay/1
``` ```
```console ```console
Elapsed time: 1.099171542s Elapsed time: 1.099171542s
``` ```
PUT /put HTTP/1.1 The [extra verbose `-vv` output](#extra-verbose-output) includes the meta section by default. You can also show it in combination with other parts of the exchange via [`--print=m`](#what-parts-of-the-http-exchange-should-be-printed). For example, here we print it together with the response headers:
```bash ```bash
$ http --print=hm pie.dev/get $ http --print=hm pie.dev/get
@ -1471,7 +1471,32 @@ $ http --print=Hh PUT pie.dev/put hello=world
``` ```
Connection: keep-alive
Please note that it also includes time spent on formatting the output, which adds a small penalty. Also, if the body is not part of the output, [we don’t spend time downloading it](#conditional-body-download).
If you [use `--style` with one of the Pie themes](#colors-and-formatting), you’ll see the time information color-coded (green/orange/red) based on how long the exchange took.
### Verbose output
`--verbose` can often be useful for debugging the request and generating documentation examples:
```bash
$ http --verbose PUT pie.dev/put hello=world
PUT /put HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json
Host: pie.dev
User-Agent: HTTPie/0.2.7dev
{
"hello": "world"
}
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 477
Content-Type: application/json Content-Type: application/json
Date: Sun, 05 Aug 2012 00:25:23 GMT Date: Sun, 05 Aug 2012 00:25:23 GMT
Server: gunicorn/0.13.4 Server: gunicorn/0.13.4
@ -1505,9 +1530,9 @@ Server: gunicorn/0.13.4
```bash ```bash
# There will be no output, even in case of an unexpected response status code: # There will be no output, even in case of an unexpected response status code:
$ http -qq --check-status pie.dev/post enjoy='the silence without warnings' $ http -qq --check-status pie.dev/post enjoy='the silence without warnings'
$ http -qq --check-status pie.dev/post enjoy='the silence without warnings' ```
### Viewing intermediary requests/responses
To see all the HTTP communication, i.e. the final request/response as well as any possible intermediary requests/responses, use the `--all` option. To see all the HTTP communication, i.e. the final request/response as well as any possible intermediary requests/responses, use the `--all` option.
The intermediary HTTP communication include followed redirects (with `--follow`), the first unauthorized request when HTTP digest authentication is used (`--auth=digest`), etc. The intermediary HTTP communication include followed redirects (with `--follow`), the first unauthorized request when HTTP digest authentication is used (`--auth=digest`), etc.