xh — Friendly and Fast HTTPie-Compatible HTTP Client in Rust
xh is a blazing-fast HTTP client with an HTTPie-compatible UX, written in Rust, shipping as a single static binary with built-in JSON syntax highlighting, forms, sessions, and HTTP/2.
Staging sûr pour cet actif
Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.
npx -y tokrepo@latest install bc2fcb99-389d-11f1-9bc6-00163e2b0d79 --target codexStage les fichiers d'abord; l'activation exige la revue du README et du plan staged.
What it is
xh is a command-line HTTP client written in Rust that provides an HTTPie-compatible user experience with better performance. It ships as a single static binary with built-in JSON syntax highlighting, form submission, session management, and HTTP/2 support. The syntax matches HTTPie, so existing HTTPie users can switch without relearning commands.
xh targets developers and API testers who want a fast, portable HTTP client for the terminal. Its single-binary distribution means no Python runtime dependency (unlike HTTPie) and near-instant startup times.
How it saves time or tokens
xh starts faster than HTTPie because it is a compiled binary, not a Python script. For developers making dozens of API calls during a debugging session, the accumulated startup time savings are noticeable. The built-in JSON highlighting and formatting mean you do not need to pipe output through jq for readability. Session support persists cookies and auth across requests without manual header management.
How to use
- Install xh:
brew install xh
- Make HTTP requests with readable syntax:
# GET with pretty JSON
xh httpbin.org/json
# POST JSON body with header
xh POST api.example.com/users name=alice role=admin \
Authorization:'Bearer $TOKEN'
# Form submission
xh -f POST example.com/login username=admin password=secret
- Use sessions for persistent cookies:
xh --session=myapi POST api.example.com/login
xh --session=myapi GET api.example.com/profile
Example
API testing workflow with xh:
# Test an API endpoint with JSON payload
xh POST https://api.example.com/v1/messages \
content-type:application/json \
model=claude-sonnet-4-20250514 \
max_tokens:=1024 \
messages:='[{"role":"user","content":"Hello"}]'
# Download a file
xh -d https://example.com/report.pdf -o report.pdf
# Follow redirects and show headers
xh -v --follow https://short.url/abc
The := syntax sends raw JSON values (numbers, arrays, booleans) without quoting.
Related on TokRepo
- AI Tools for API — API tools for testing and development
- AI Tools for DevOps — DevOps tools for debugging and infrastructure management
Common pitfalls
- The
=syntax sends string values;:=sends raw JSON. Using=for a number sends it as a string, which may cause API validation errors. - Session files store cookies and auth tokens in plain text. Protect session files with appropriate filesystem permissions.
- xh does not support HTTPie plugins. If you rely on HTTPie's plugin ecosystem, check whether xh covers your specific use case natively.
- Always check the official documentation for the latest version-specific changes and migration guides before upgrading in production environments.
- For team deployments, establish clear guidelines on configuration and usage patterns to ensure consistency across developers.
Questions fréquentes
Yes for most use cases. xh supports HTTPie's syntax for headers, JSON bodies, form data, and authentication. Some advanced HTTPie plugins and features may not be available in xh.
xh provides human-friendly syntax and formatted output by default. JSON is highlighted, headers are readable, and the request syntax is intuitive. curl provides more raw control but requires more flags and piping for readable output.
Yes. xh supports HTTP/2 natively without additional configuration. It negotiates the protocol version automatically with servers that support HTTP/2.
Sessions persist cookies, authentication, and custom headers across requests. Use --session=name to create or continue a session. Session data is stored in files that are reused on subsequent requests.
Yes. xh supports multipart file uploads using the @ syntax. For example: xh -f POST api.example.com/upload file@report.pdf uploads the file as multipart form data.
Sources citées (3)
- xh GitHub— xh is a fast HTTPie-compatible HTTP client written in Rust
- HTTPie Documentation— HTTPie-compatible CLI syntax for HTTP requests
- Rust Documentation— Rust static binary compilation for portable tools
En lien sur TokRepo
Fil de discussion
Actifs similaires
Got — Human-Friendly HTTP Client for Node.js
Got is a lightweight, feature-rich HTTP client for Node.js with built-in retry logic, pagination, caching, and hooks for composable request pipelines.
HTTPie CLI — Modern User-Friendly Command-Line HTTP Client
HTTPie is a modern, user-friendly command-line HTTP client for the API era. Intuitive syntax, formatted and colorized output, JSON support, sessions, authentication, file uploads, and plugins. The friendly alternative to curl for API exploration.
OkHttp — Modern HTTP Client for Java and Kotlin
A reliable and efficient HTTP client for the JVM and Android with connection pooling, transparent GZIP, response caching, and WebSocket support.
Zola — Fast Static Site Generator in a Single Rust Binary
Zola is a fast static site generator built as a single Rust binary with everything built in: Sass compilation, syntax highlighting, table of contents, search index, image processing, and shortcodes. No external dependencies or plugins needed.