{"id":13478352,"url":"https://github.com/ducaale/xh","last_synced_at":"2025-05-14T07:02:55.588Z","repository":{"id":37497539,"uuid":"294521053","full_name":"ducaale/xh","owner":"ducaale","description":"Friendly and fast tool for sending HTTP requests","archived":false,"fork":false,"pushed_at":"2025-05-02T14:21:14.000Z","size":2798,"stargazers_count":6323,"open_issues_count":36,"forks_count":104,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-05-07T06:19:09.192Z","etag":null,"topics":["api-testing","cli","developer-tools","http-client","rust","terminal"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ducaale.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-09-10T20:58:13.000Z","updated_at":"2025-05-07T05:59:12.000Z","dependencies_parsed_at":"2023-10-01T16:30:41.697Z","dependency_job_id":"b2fbc5bc-95ad-4dad-b4d7-cb3737ecef30","html_url":"https://github.com/ducaale/xh","commit_stats":{"total_commits":1340,"total_committers":39,"mean_commits":34.35897435897436,"dds":"0.27910447761194035","last_synced_commit":"ef4429dd03400b109153561a62b27c82b322ae4f"},"previous_names":["ducaale/ht"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducaale%2Fxh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducaale%2Fxh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducaale%2Fxh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducaale%2Fxh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ducaale","download_url":"https://codeload.github.com/ducaale/xh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092648,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-testing","cli","developer-tools","http-client","rust","terminal"],"created_at":"2024-07-31T16:01:55.894Z","updated_at":"2025-05-14T07:02:55.528Z","avatar_url":"https://github.com/ducaale.png","language":"Rust","readme":"# xh\n[![Version info](https://img.shields.io/crates/v/xh.svg)](https://crates.io/crates/xh)\n[![Packaging status](https://repology.org/badge/tiny-repos/xh.svg)](https://repology.org/project/xh/versions)\n\n`xh` is a friendly and fast tool for sending HTTP requests. It reimplements as much\nas possible of [HTTPie's](https://httpie.io/) excellent design, with a focus\non improved performance.\n\n[![asciicast](/assets/xh-demo.gif)](https://asciinema.org/a/475190)\n\n## Installation\n\n### via cURL (Linux \u0026 macOS)\n\n```\ncurl -sfL https://raw.githubusercontent.com/ducaale/xh/master/install.sh | sh\n```\n\n### via Powershell (Windows)\n\n```\niwr -useb https://raw.githubusercontent.com/ducaale/xh/master/install.ps1 | iex\n```\n\n\n### via a package manager\n\n| OS                            | Method     | Command                                    |\n|-------------------------------|------------|--------------------------------------------|\n| Any                           | Cargo\\*    | `cargo install xh --locked`                |\n| Any                           | [Huber]    | `huber install xh`                         |\n| Android ([Termux])            | pkg        | `pkg install xh`                           |\n| Android ([Magisk]/[KernelSU]) | MMRL\\*\\*   | `mmrl install xhhttp`                      |\n| Alpine Linux                  | apk\\*\\*\\*  | `apk add xh`                               |\n| Arch Linux                    | Pacman     | `pacman -S xh`                             |\n| Debian \u0026 Ubuntu               | Apt\\*\\*\\*\\*| `sudo apt install xh`                      |\n| FreeBSD                       | FreshPorts | `pkg install xh`                           |\n| NetBSD                        | pkgsrc     | `pkgin install xh`                         |\n| Linux \u0026 macOS                 | Nixpkgs    | `nix-env -iA nixpkgs.xh`                   |\n| Linux \u0026 macOS                 | [Flox]     | `flox install xh`                          |\n| Linux \u0026 macOS                 | Homebrew   | `brew install xh`                          |\n| Linux \u0026 macOS                 | [Hermit]   | `hermit install xh`                        |\n| macOS                         | MacPorts   | `sudo port install xh`                     |\n| Windows                       | Scoop      | `scoop install xh`                         |\n| Windows                       | Chocolatey | `choco install xh`                         |\n| Windows                       | Winget     | `winget add ducaale.xh`                    |\n\n\\* Make sure that you have Rust 1.74 or later installed\n\n\\*\\* You will need to install the [MMRL CLI](https://github.com/DerGoogler/MMRL-CLI/releases)\n\n\\*\\*\\* The xh package is available in Edge and will be in v3.17+. It is built with native-tls only.\n\n\\*\\*\\*\\* You will need to add the apt repository from https://apt.cli.rs/\n\n[Huber]: https://github.com/innobead/huber#installing-huber\n[Magisk]: https://github.com/topjohnwu/Magisk\n[KernelSU]: https://kernelsu.org\n[Termux]: https://github.com/termux/termux-app\n[Flox]: https://flox.dev/docs/\n[Hermit]: https://cashapp.github.io/hermit/\n\n### via pre-built binaries\nThe [release page](https://github.com/ducaale/xh/releases) contains prebuilt binaries for Linux, macOS and Windows.\n\n## Usage\n```\nUsage: xh [OPTIONS] \u003c[METHOD] URL\u003e [REQUEST_ITEM]...\n\nArguments:\n  \u003c[METHOD] URL\u003e     The request URL, preceded by an optional HTTP method\n  [REQUEST_ITEM]...  Optional key-value pairs to be included in the request.\n\nOptions:\n  -j, --json                             (default) Serialize data items from the command line as a JSON object\n  -f, --form                             Serialize data items from the command line as form fields\n      --multipart                        Like --form, but force a multipart/form-data request even without files\n      --raw \u003cRAW\u003e                        Pass raw request data without extra processing\n      --pretty \u003cSTYLE\u003e                   Controls output processing [possible values: all, colors, format, none]\n      --format-options \u003cFORMAT_OPTIONS\u003e  Set output formatting options\n  -s, --style \u003cTHEME\u003e                    Output coloring style [possible values: auto, solarized, monokai, fruity]\n      --response-charset \u003cENCODING\u003e      Override the response encoding for terminal display purposes\n      --response-mime \u003cMIME_TYPE\u003e        Override the response mime type for coloring and formatting for the terminal\n  -p, --print \u003cFORMAT\u003e                   String specifying what the output should contain\n  -h, --headers                          Print only the response headers. Shortcut for --print=h\n  -b, --body                             Print only the response body. Shortcut for --print=b\n  -m, --meta                             Print only the response metadata. Shortcut for --print=m\n  -v, --verbose...                       Print the whole request as well as the response\n      --debug                            Print full error stack traces and debug log messages\n      --all                              Show any intermediary requests/responses while following redirects with --follow\n  -P, --history-print \u003cFORMAT\u003e           The same as --print but applies only to intermediary requests/responses\n  -q, --quiet...                         Do not print to stdout or stderr\n  -S, --stream                           Always stream the response body\n  -x, --compress...                      Content compressed (encoded) with Deflate algorithm\n  -o, --output \u003cFILE\u003e                    Save output to FILE instead of stdout\n  -d, --download                         Download the body to a file instead of printing it\n  -c, --continue                         Resume an interrupted download. Requires --download and --output\n      --session \u003cFILE\u003e                   Create, or reuse and update a session\n      --session-read-only \u003cFILE\u003e         Create or read a session without updating it form the request/response exchange\n  -A, --auth-type \u003cAUTH_TYPE\u003e            Specify the auth mechanism [possible values: basic, bearer, digest]\n  -a, --auth \u003cUSER[:PASS] | TOKEN\u003e       Authenticate as USER with PASS (-A basic|digest) or with TOKEN (-A bearer)\n      --ignore-netrc                     Do not use credentials from .netrc\n      --offline                          Construct HTTP requests without sending them anywhere\n      --check-status                     (default) Exit with an error status code if the server replies with an error\n  -F, --follow                           Do follow redirects\n      --max-redirects \u003cNUM\u003e              Number of redirects to follow. Only respected if --follow is used\n      --timeout \u003cSEC\u003e                    Connection timeout of the request\n      --proxy \u003cPROTOCOL:URL\u003e             Use a proxy for a protocol. For example: --proxy https:http://proxy.host:8080\n      --verify \u003cVERIFY\u003e                  If \"no\", skip SSL verification. If a file path, use it as a CA bundle\n      --cert \u003cFILE\u003e                      Use a client side certificate for SSL\n      --cert-key \u003cFILE\u003e                  A private key file to use with --cert\n      --ssl \u003cVERSION\u003e                    Force a particular TLS version [possible values: auto, tls1, tls1.1, tls1.2, tls1.3]\n      --https                            Make HTTPS requests if not specified in the URL\n      --http-version \u003cVERSION\u003e           HTTP version to use [possible values: 1.0, 1.1, 2, 2-prior-knowledge]\n      --resolve \u003cHOST:ADDRESS\u003e           Override DNS resolution for specific domain to a custom IP\n      --interface \u003cNAME\u003e                 Bind to a network interface or local IP address\n  -4, --ipv4                             Resolve hostname to ipv4 addresses only\n  -6, --ipv6                             Resolve hostname to ipv6 addresses only\n  -I, --ignore-stdin                     Do not attempt to read stdin\n      --curl                             Print a translation to a curl command\n      --curl-long                        Use the long versions of curl's flags\n      --generate \u003cKIND\u003e                  Generate shell completions or man pages\n      --help                             Print help\n  -V, --version                          Print version\n\nEach option can be reset with a --no-OPTION argument.\n```\n\nRun `xh help` for more detailed information.\n\n### Request Items\n\n`xh` uses [HTTPie's request-item syntax](https://httpie.io/docs/cli/request-items) to set headers, request body, query string, etc.\n\n- `=`/`:=` for setting the request body's JSON or form fields (`=` for strings and `:=` for other JSON types).\n- `==` for adding query strings.\n- `@` for including files in multipart requests e.g `picture@hello.jpg` or `picture@hello.jpg;type=image/jpeg;filename=goodbye.jpg`.\n- `:` for adding or removing headers e.g `connection:keep-alive` or `connection:`.\n- `;` for including headers with empty values e.g `header-without-value;`.\n\nAn `@` prefix can be used to read a value from a file. For example: `x-api-key:@api-key.txt`.\n\nThe request body can also be read from standard input, or from a file using `@filename`.\n\nTo construct a complex JSON object, a JSON path can be used as a key e.g `app[container][0][id]=090-5`.\nFor more information on this syntax, refer to https://httpie.io/docs/cli/nested-json.\n\n### Shorthand form for URLs\n\nSimilar to HTTPie, specifying the scheme portion of the request URL is optional, and a leading colon works as shorthand\nfor localhost. `:8000` is equivalent to `localhost:8000`, and `:/path` is equivalent to `localhost/path`.\n\nURLs can have a leading `://` which allows quickly converting a URL into a valid xh or HTTPie command. For example\n`http://httpbin.org/json` becomes `http ://httpbin.org/json`.\n\n\n```sh\nxh http://localhost:3000/users # resolves to http://localhost:3000/users\nxh localhost:3000/users        # resolves to http://localhost:3000/users\nxh :3000/users                 # resolves to http://localhost:3000/users\nxh :/users                     # resolves to http://localhost:80/users\nxh example.com                 # resolves to http://example.com\nxh ://example.com              # resolves to http://example.com\n```\n\n### Making HTTPS requests by default\n\n`xh` will default to HTTPS scheme if the binary name is one of `xhs`, `https`, or `xhttps`. If you have installed `xh`\nvia a package manager, both `xh` and `xhs` should be available by default. Otherwise, you need to create one like this:\n\n```sh\ncd /path/to/xh \u0026\u0026 ln -s ./xh ./xhs\nxh httpbin.org/get  # resolves to http://httpbin.org/get\nxhs httpbin.org/get # resolves to https://httpbin.org/get\n```\n\n### Strict compatibility mode\n\nIf `xh` is invoked as `http` or `https` (by renaming the binary), or if the `XH_HTTPIE_COMPAT_MODE` environment variable is set,\nit will run in HTTPie compatibility mode. The only current difference is that `--check-status` is not enabled by default.\n\n## Examples\n\n```sh\n# Send a GET request\nxh httpbin.org/json\n\n# Send a POST request with body {\"name\": \"ahmed\", \"age\": 24}\nxh httpbin.org/post name=ahmed age:=24\n\n# Send a GET request with querystring id=5\u0026sort=true\nxh get httpbin.org/json id==5 sort==true\n\n# Send a GET request and include a header named x-api-key with value 12345\nxh get httpbin.org/json x-api-key:12345\n\n# Send a POST request with body read from stdin.\necho \"[1, 2, 3]\" | xh post httpbin.org/post\n\n# Send a PUT request and pipe the result to less\nxh put httpbin.org/put id:=49 age:=25 | less\n\n# Download and save to res.json\nxh -d httpbin.org/json -o res.json\n\n# Make a request with a custom user agent\nxh httpbin.org/get user-agent:foobar\n```\n\n## How xh compares to HTTPie\n\n### Advantages\n\n- Improved startup speed.\n- Available as a single statically linked binary that's easy to install and carry around.\n- HTTP/2 support.\n- Builtin translation to curl commands with the `--curl` flag.\n- Short, cheatsheet-style output from `--help`. (For longer output, pass `help`.)\n\n### Disadvantages\n\n- Not all of HTTPie's features are implemented. ([#4](https://github.com/ducaale/xh/issues/4))\n- No plugin system.\n- General immaturity. HTTPie is old and well-tested.\n- Worse documentation.\n\n## Similar or related Projects\n\n- [curlie](https://github.com/rs/curlie) - frontend to cURL that adds the ease of use of httpie\n- [httpie-go](https://github.com/nojima/httpie-go) - httpie-like HTTP client written in Go\n- [curl2httpie](https://github.com/dcb9/curl2httpie) - convert command arguments between cURL and HTTPie\n","funding_links":[],"categories":["Rust","Libraries","Command Line","Projects","Tech","Command Line Tools","Applications","Tools","Uncategorized","CLI Tools","cli","Recently Updated","Don't forget to give a :star: to make the project popular","\u003ca name=\"transfer\"\u003e\u003c/a\u003eData transfer","Downloading and Serving","CLI","Table of contents"],"sub_categories":["Web programming","Dependency Management","API Testing","Tools","System tools","Rust","Uncategorized","31. [xh](https://github.com/ducaale/xh)","[Apr 03, 2025](/content/2025/04/03/README.md)","Directory Navigation","CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fducaale%2Fxh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fducaale%2Fxh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fducaale%2Fxh/lists"}