|
5 | 5 | > See also: `http`, `curl`.
|
6 | 6 | > More information: <https://github.com/ducaale/xh>.
|
7 | 7 |
|
8 |
| -- Send a GET request: |
| 8 | +- Send a GET request (shows response headers and content): |
9 | 9 |
|
10 |
| -`xh {{httpbin.org/get}}` |
| 10 | +`xh {{https://postman-echo.com/get}}` |
11 | 11 |
|
12 | 12 | - 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}`):
|
13 | 13 |
|
14 |
| -`xh post {{httpbin.org/post}} {{name=john}} {{age:=25}}` |
| 14 | +`xh post {{https://postman-echo.com/post}} {{name=john}} {{age=25}}` |
15 | 15 |
|
16 |
| -- Send a GET request with query parameters (e.g. `first_param=5&second_param=true`): |
| 16 | +- Send a GET request with query parameters (e.g. `https://postman-echo.com/response-headers?foo1=bar1&foo2=bar2`): |
17 | 17 |
|
18 |
| -`xh get {{httpbin.org/get}} {{first_param==5}} {{second_param==true}}` |
| 18 | +`xh get {{https://postman-echo.com/response-headers}} {{foo1==bar1}} {{foo2==bar2}}` |
19 | 19 |
|
20 | 20 | - Send a GET request with a custom header:
|
21 | 21 |
|
22 |
| -`xh get {{httpbin.org/get}} {{header-name:header-value}}` |
| 22 | +`xh get {{https://postman-echo.com}} {{header-name:header-value}}` |
23 | 23 |
|
24 | 24 | - Make a GET request and save the response body to a file:
|
25 | 25 |
|
26 |
| -`xh --download {{httpbin.org/json}} --output {{path/to/file}}` |
| 26 | +`xh {{[-d|--download]}} {{https://example.com}} {{[-o|--output]}} {{path/to/file}}` |
| 27 | + |
| 28 | +- Construct a request but do not send it (similar to a dry-run): |
| 29 | + |
| 30 | +`xh --offline {{get|delete|...}} {{https://example.com}}` |
27 | 31 |
|
28 | 32 | - Show equivalent `curl` command (this will not send any request):
|
29 | 33 |
|
30 |
| -`xh --{{curl|curl-long}} {{--follow --verbose get http://example.com user-agent:curl}}` |
| 34 | +`xh --{{curl|curl-long}} {{--follow --verbose get https://example.com user-agent:curl}}` |
0 commit comments