xh

A friendly and fast HTTP client for sending HTTP requests, inspired by HTTPie but significantly faster.

Screenshot of xh

xh is a reimplementation of HTTPie in Rust. It focuses on being a simpler, faster alternative for sending HTTP requests from the command line — with a human-friendly syntax for building requests, syntax-highlighted output, and support for sessions, redirects, and file uploads.

Features

  • HTTPie-compatible syntax — if you know HTTPie, you already know xh
  • Syntax-highlighted output — response headers and bodies are colorized and pretty-printed automatically
  • JSON-first — request bodies default to JSON; no need for -H "Content-Type: application/json"
  • Sessions — persist cookies and headers across requests with named session files
  • HTTPS — TLS support out of the box, with optional certificate verification control
  • HTTP/2 — supports HTTP/2 when the server advertises it
  • --curl flag — translates your xh command into the equivalent curl invocation
  • Offline mode — construct and print a request without sending it

Installation

cargo install xh

Or via your system package manager:

# Arch Linux
pacman -S xh

# macOS
brew install xh

# Debian/Ubuntu (via apt)
# Download the latest release binary from GitHub

Usage

# Simple GET request
xh httpbin.org/get

# POST with JSON body (key=value pairs are JSON by default)
xh POST httpbin.org/post name=Alice age:=30

# Set request headers
xh httpbin.org/headers X-My-Header:foo Authorization:"Bearer token123"

# POST a form
xh --form POST httpbin.org/post username=alice password=secret

# Download a file
xh --download httpbin.org/image/png

# Use a named session (persists cookies/headers)
xh --session=myapi POST api.example.com/login username=alice password=secret

# Follow redirects
xh --follow httpbin.org/redirect/3

# Print only the response body
xh --body httpbin.org/get

# Translate to a curl command without sending
xh --curl POST httpbin.org/post name=Alice

HTTPie compatibility

xh aims to be a drop-in replacement for HTTPie. You can symlink http and https to xh and use it exactly as you would HTTPie:

ln -s $(which xh) /usr/local/bin/http
ln -s $(which xh) /usr/local/bin/https