2021-04-05 15:01:13 +02:00
|
|
|
# xh
|
|
|
|
|
2021-04-05 15:37:44 +02:00
|
|
|
> Friendly and fast tool for sending HTTP requests.
|
2024-09-13 17:34:08 +10:00
|
|
|
> Note: `xh`, written in rust, serves as an effective drop-in replacement for `http`.
|
|
|
|
> See also: `http`, `curl`.
|
2021-04-05 15:01:13 +02:00
|
|
|
> More information: <https://github.com/ducaale/xh>.
|
|
|
|
|
2025-05-17 13:06:07 +10:00
|
|
|
- Send a GET request (shows response headers and content):
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2025-05-17 13:06:07 +10:00
|
|
|
`xh {{https://postman-echo.com/get}}`
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2021-04-11 16:28:23 +02:00
|
|
|
- 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}`):
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2025-05-17 13:06:07 +10:00
|
|
|
`xh post {{https://postman-echo.com/post}} {{name=john}} {{age=25}}`
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2025-05-17 13:06:07 +10:00
|
|
|
- Send a GET request with query parameters (e.g. `https://postman-echo.com/response-headers?foo1=bar1&foo2=bar2`):
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2025-05-17 13:06:07 +10:00
|
|
|
`xh get {{https://postman-echo.com/response-headers}} {{foo1==bar1}} {{foo2==bar2}}`
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2021-04-05 15:44:14 +02:00
|
|
|
- Send a GET request with a custom header:
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2025-05-17 13:06:07 +10:00
|
|
|
`xh get {{https://postman-echo.com}} {{header-name:header-value}}`
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2021-04-05 15:45:04 +02:00
|
|
|
- Make a GET request and save the response body to a file:
|
2021-04-05 15:01:13 +02:00
|
|
|
|
2025-05-17 13:06:07 +10:00
|
|
|
`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}}`
|
2024-09-13 17:34:08 +10:00
|
|
|
|
|
|
|
- Show equivalent `curl` command (this will not send any request):
|
|
|
|
|
2025-05-17 13:06:07 +10:00
|
|
|
`xh --{{curl|curl-long}} {{--follow --verbose get https://example.com user-agent:curl}}`
|