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.

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

-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

--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

--pretty <STYLE>

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

-s, --style <THEME>

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

-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`

-o, --output <FILE>

    Save output to FILE instead of stdout

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

    Authenticate as USER with PASS. PASS will be prompted if missing.

    Use a trailing colon (i.e. `USER:`) to authenticate with just a username.

--bearer <TOKEN>

    Authenticate with a bearer token

--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.

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