mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-06-08 02:45:59 +02:00
xh: refresh page and add examples (#16504)
This commit is contained in:
parent
40c17acfea
commit
9817ecee4c
1 changed files with 12 additions and 8 deletions
|
@ -5,26 +5,30 @@
|
||||||
> See also: `http`, `curl`.
|
> See also: `http`, `curl`.
|
||||||
> More information: <https://github.com/ducaale/xh>.
|
> More information: <https://github.com/ducaale/xh>.
|
||||||
|
|
||||||
- Send a GET request:
|
- Send a GET request (shows response headers and content):
|
||||||
|
|
||||||
`xh {{httpbin.org/get}}`
|
`xh {{https://postman-echo.com/get}}`
|
||||||
|
|
||||||
- Send a POST request with a JSON body (key-value pairs are added to a top-level JSON object - e.g. `{"name": "john", "age": 25}`):
|
- Send a POST request with a JSON body (key-value pairs are added to a top-level JSON object - e.g. `{"name": "john", "age": 25}`):
|
||||||
|
|
||||||
`xh post {{httpbin.org/post}} {{name=john}} {{age:=25}}`
|
`xh post {{https://postman-echo.com/post}} {{name=john}} {{age=25}}`
|
||||||
|
|
||||||
- Send a GET request with query parameters (e.g. `first_param=5&second_param=true`):
|
- Send a GET request with query parameters (e.g. `https://postman-echo.com/response-headers?foo1=bar1&foo2=bar2`):
|
||||||
|
|
||||||
`xh get {{httpbin.org/get}} {{first_param==5}} {{second_param==true}}`
|
`xh get {{https://postman-echo.com/response-headers}} {{foo1==bar1}} {{foo2==bar2}}`
|
||||||
|
|
||||||
- Send a GET request with a custom header:
|
- Send a GET request with a custom header:
|
||||||
|
|
||||||
`xh get {{httpbin.org/get}} {{header-name:header-value}}`
|
`xh get {{https://postman-echo.com}} {{header-name:header-value}}`
|
||||||
|
|
||||||
- Make a GET request and save the response body to a file:
|
- Make a GET request and save the response body to a file:
|
||||||
|
|
||||||
`xh --download {{httpbin.org/json}} --output {{path/to/file}}`
|
`xh {{[-d|--download]}} {{https://example.com}} {{[-o|--output]}} {{path/to/file}}`
|
||||||
|
|
||||||
|
- Construct a request but do not send it (similar to a dry-run):
|
||||||
|
|
||||||
|
`xh --offline {{get|delete|...}} {{https://example.com}}`
|
||||||
|
|
||||||
- Show equivalent `curl` command (this will not send any request):
|
- Show equivalent `curl` command (this will not send any request):
|
||||||
|
|
||||||
`xh --{{curl|curl-long}} {{--follow --verbose get http://example.com user-agent:curl}}`
|
`xh --{{curl|curl-long}} {{--follow --verbose get https://example.com user-agent:curl}}`
|
||||||
|
|
Loading…
Add table
Reference in a new issue