Introduction
xh gives you HTTPie's human-friendly syntax at Rust-level speed and portability. It's a single binary you can drop into Alpine containers and CI runners without pulling in Python. For teams that love HTTPie's key=value body shorthand and colorized JSON but resent the cold-start cost, xh is a near drop-in replacement.
What xh Does
- Performs HTTP/1.1, HTTP/2, and HTTPS requests from the command line.
- Offers HTTPie-style shorthand for JSON (
name=value), strings (::), raw JSON (:=), forms (--form), files (@path), and headers (Key:value). - Pretty-prints JSON and colorizes request/response.
- Supports sessions, downloads, resumable transfers, multipart uploads.
- Ships as a single ~5MB static binary.
Architecture Overview
xh is built on reqwest (hyper + rustls) and clap. A request parser translates CLI tokens into typed body/header/query segments, then hyper executes the request. Output is pretty-printed by serde_json and syntect. HTTP/2 and TLS come from rustls with no OpenSSL dependency.
Self-Hosting & Configuration
- Install via
brew install xh,cargo install xh, or binary release. - Sessions stored as JSON in
~/.config/xh/sessions/. XH_CONFIG_DIRoverrides location.- Works offline:
--offlineprints the request without sending. - Supports
.netrc, client certs, proxies, and custom CA bundles.
Key Features
- HTTPie-compatible syntax — muscle memory transfers.
- ~3–6× faster cold start than HTTPie (no Python interpreter).
- Single-binary distribution, ideal for containers and CI.
- HTTP/2, HSTS, and rustls by default.
- Session support and
--downloadwith resume.
Comparison with Similar Tools
- HTTPie (Python) — same UX; heavier install, slower startup.
- curl — ubiquitous but verbose; no JSON shorthand.
- curlie — curl wrapper in Go with HTTPie syntax; fewer features than xh.
- Hurl — file-based runner for test suites; different use case.
- Bruno/Postman — GUI and collections; xh is CLI-only.
FAQ
Q: Is xh a drop-in replacement for HTTPie? A: 95% — most recipes work unchanged; a few niche flags differ.
Q: Does it support HTTP/3?
A: Experimental via --http3 when built with the http3 feature.
Q: How do I pin TLS versions?
A: --tls 1.3 forces TLS 1.3.
Q: Can I import an HTTPie session?
A: Copy the JSON into ~/.config/xh/sessions/<host>/<name>.json.