xh
Sessions Commands
Create named sessions to persist headers, cookies, and auth across requests.
11 commands
Pro Tips
Sessions persist headers and cookies between requests
Commands
Create session
$ xh --session=api POST https://api.example.com/login user=admin
Create a named session.
Use session
$ xh --session=api GET https://api.example.com/protected
Use existing session.
Read-only session
$ xh --session-read-only=api GET https://api.example.com
Use session without saving.
Anonymous session
$ xh --session=/tmp/anon-session.json GET https://api.example.com
Use a file path for an anonymous session.
Session with auth
$ xh --session=myapi -a user:pass GET https://api.example.com/data
Store credentials in a named session.
Skip TLS verification
$ xh --verify=no GET https://self-signed.example.com
Disable TLS certificate verification.
Client certificate
$ xh --cert=client.pem --cert-key=key.pem GET https://api.example.com
Use a client TLS certificate for mutual TLS.
Use proxy
$ xh --proxy=https:http://proxy.example.com:8080 GET https://api.example.com
Route requests through an HTTP proxy.
Set timeout
$ xh --timeout=30 GET https://api.example.com/slow-endpoint
Set request timeout in seconds.
Force HTTP/2
$ xh --http-version=2 GET https://api.example.com
Use HTTP/2 for the request.
Default scheme shorthand
$ xh :3000/api/health
Shorthand for http://localhost:3000.