XH(1)

NAME
xh - Friendly and fast tool for sending HTTP requests

SYNOPSIS
xh [OPTIONS] <[METHOD] URL> [--] [REQUEST_ITEM]...

DESCRIPTION
xh is a friendly and fast tool for sending HTTP requests.

It reimplements as much as possible of HTTPie's excellent design, with a focus on improved performance.

OPTIONS

  Positional Arguments

METHOD

    The HTTP method to use. One of get, post, head, put, patch, delete, or options.

    Optional. If omitted, a GET or a POST will be done depending on whether the request sends data.

URL

    The URL to request. The scheme defaults to 'http://' unless --https is used.

    A leading colon works as shorthand for localhost. :8000 is equivalent to localhost:8000, and :/path is equivalent to localhost/path.

REQUEST_ITEM...

    Optional key-value pairs to be included in the request.

    key==value to add a parameter to the URL

    key=value to add a JSON field (--json) or form field (--form)

    key=@value to add a JSON field (--json) or form field (--form) from a file.

    key:=value to add a complex JSON value (e.g. `numbers:=[1,2,3]`)

    key:=@value to add a complex JSON value (e.g. `numbers:=@data.json`) from a file.

    key@filename to upload a file from filename (with --form)

    @filename to use a file as the request body

    header:value to add a header

    header: to unset a header

    header; to add a header with an empty value

    A backslash can be used to escape special characters (e.g. weird\:key=value).

    File uploads can take ';type=' and ';filename=' parameters to set the mimetype and filename, respectively. For example:

      key@filename;type=text/html;filename=document.html

  Flags

-j, --json

    (default) Serialize data items from the command line as a JSON object

-f, --form

    Serialize data items from the command line as form fields

-m, --multipart

    Like --form, but force a multipart/form-data request even without files

-h, --headers

    Print only the response headers. Shortcut for --print=h

-b, --body

    Print only the response body. Shortcut for --print=b

-v, --verbose

    Print the whole request as well as the response

--all

    Show any intermediary requests/responses while following redirects with --follow

-q, --quiet

    Do not print to stdout or stderr

-S, --stream

    Always stream the response body

-d, --download

    Download the body to a file instead of printing it

-c, --continue

    Resume an interrupted download. Requires --download and --output

--ignore-netrc

    Do not use credentials from .netrc

--offline

    Construct HTTP requests without sending them anywhere

--check-status

    (default) Exit with an error status code if the server replies with an error.

    The exit code will be 4 on 4xx (Client Error), 5 on 5xx (Server Error), or 3 on 3xx (Redirect) if --follow isn't set.

    If stdout is redirected then a warning is written to stderr.

-F, --follow

    Do follow redirects

--native-tls

    Use the system TLS library instead of rustls (if enabled at compile time)

--https

    Make HTTPS requests if not specified in the URL

-I, --ignore-stdin

    Do not attempt to read stdin

--curl

    Print a translation to a `curl` command.

    For translating the other way, try https://curl2httpie.online/.

--curl-long

    Use the long versions of curl's flags

--help

    Prints help information

-V, --version

    Prints version information

--raw <RAW>

    Pass raw request data without extra processing

--pretty <STYLE>

    Controls output processing [possible values: all, colors, format, none]

-s, --style <THEME>

    Output coloring style [possible values: auto, solarized, monokai, fruity]

--response-charset <ENCODING>

    Override the response encoding for terminal display purposes.

    Example: `--response-charset=latin1`

--response-mime <MIME_TYPE>

    Override the response mime type for coloring and formatting for the terminal

    Example: `--response-mime=application/json`

-p, --print <FORMAT>

    String specifying what the output should contain.

    Use `H` and `B` for request header and body respectively, and `h` and `b` for response hader and body.

    Example: `--print=Hb`

-P, --history-print <FORMAT>

    The same as --print but applies only to intermediary requests/responses

-o, --output <FILE>

    Save output to FILE instead of stdout

--session <FILE>

    Create, or reuse and update a session.

    Within a session, custom headers, auth credentials, as well as any cookies sent by the server persist between requests.

--session-read-only <FILE>

    Create or read a session without updating it form the request/response exchange

-A, --auth-type <auth-type>

    Specify the auth mechanism [possible values: basic, bearer, digest]

-a, --auth <USER[:PASS] | TOKEN>

    Authenticate as USER with PASS or with TOKEN.

    PASS will be prompted if missing. Use a trailing colon (i.e. `USER:`) to authenticate with just a username.

    TOKEN is expected if `--auth-type=bearer`.

--max-redirects <NUM>

    Number of redirects to follow, only respected if `follow` is set

--timeout <SEC>

    Connection timeout of the request.

    The default value is `0`, i.e., there is no timeout limit.

--proxy <PROTOCOL:URL>...

    Use a proxy for a protocol. For example: `--proxy https:http://proxy.host:8080`.

    PROTOCOL can be `http`, `https` or `all`.

    If your proxy requires credentials, put them in the URL, like so: `--proxy http:socks5://user:password@proxy.host:8000`.

    You can specify proxies for multiple protocols by repeating this option.

    The environment variables `http_proxy` and `https_proxy` can also be used, but are completely ignored if --proxy is passed.

--verify <VERIFY>

    If "no", skip SSL verification. If a file path, use it as a CA bundle.

    Specifying a CA bundle will disable the system's built-in root certificates.

    "false" instead of "no" also works. The default is "yes" ("true").

--cert <FILE>

    Use a client side certificate for SSL

--cert-key <FILE>

    A private key file to use with --cert.

    Only necessary if the private key is not contained in the cert file.

--ssl <VERSION>

    Force a particular TLS version.

    "auto" or "ssl2.3" gives the default behavior of negotiating a version with the server. [possible values: auto, ssl2.3, tls1, tls1.1, tls1.2, tls1.3]

--http-version <VERSION>

    HTTP version to use [possible values: 1, 1.0, 1.1, 2]

Each option can be reset with a --no-OPTION argument.