# [`xh`](https://github.com/ducaale/xh)
[`xh`](https://github.com/ducaale/xh) is a friendlier `curl`. It uses the same CLI syntax as HTTPie.
To specify what is printed use the `-p` option:
- `H` will print request headers
- `B` request body
- `h` response headers
- `b` response body
- `m` response metadata (elapsed time and host IP)
(note that these can be combined e.g. `-p Hhb`)
Instead of performing specified action `--curl` will print out the equivalent command for [[cURL]].
- `-d` will download the response to disk
- `-o <PATH>` will save the response to disk
- `--auth <USER:PASS>` (shorthand `-a`) will perform basic authentication (can be changed to bearer or digest using `-A`). If password is omitted the user is then prompted for it. Use `<USER:>` to use an empty string as the password
- `--session <SESSION NAME>` use a named session to store cookies. By default sessions are stored in `~/.config/xh/sessions`.
- `--resolve=HOST:ADDRESS` will use the specified address for the given host.
## Request Items
Request headers, query strings, body, etc are all specified as "request items". `xh` determines the type based on formatting.
- HTTP methods are passed as is
- `header:value` request headers. Use `header;` set header to an empty value
- `key==value` query strings
- `key=value` Add field to request body. Data can be passed as form fields (`--form`) or as a json document (`--json`).