# xh
Friendly and fast HTTP client for the command line. A Rust reimplementation of [HTTPie](https://httpie.io/) with better performance and a single static binary.
## Installation
```bash
brew install xh # also installs xhs (HTTPS default)
```
## Usage
```bash
# GET request
xh httpbin.org/json
# POST with JSON body
xh httpbin.org/post name=ahmed age:=24
# GET with query string
xh get httpbin.org/json id==5 sort==true
# Custom header
xh get httpbin.org/json x-api-key:12345
# POST with body from stdin
echo "[1, 2, 3]" | xh post httpbin.org/post
# Download to file
xh -d httpbin.org/json -o res.json
# Translate to curl command
xh --curl httpbin.org/json
```
## Request Item Syntax
Follows [HTTPie's conventions](https://httpie.io/docs/cli/request-items):
| Syntax | Purpose | Example |
|--------|---------|---------|
| `=` | String field (JSON/form) | `name=ahmed` |
| `:=` | Non-string JSON field | `age:=24` |
| `==` | Query string parameter | `id==5` |
| `:` | Header | `x-api-key:12345` |
| `@` | File upload (multipart) | `
[email protected]` |
## Shortcuts
- `:3000/users` → `http://localhost:3000/users`
- `xhs` uses HTTPS by default (symlink installed by brew)
- `--curl` / `--curl-long` to translate requests to curl
## vs HTTPie
Faster startup (single static binary, no Python), HTTP/2 support, built-in curl translation. Trade-off: not all HTTPie features, no plugin system.