All Projects → ducaale → Xh

ducaale / Xh

Licence: mit
Friendly and fast tool for sending HTTP requests

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Xh

Hoppscotch
👽 Open source API development ecosystem https://hoppscotch.io
Stars: ✭ 34,569 (+2634.89%)
Mutual labels:  http-client, developer-tools
Curlie
The power of curl, the ease of use of httpie.
Stars: ✭ 877 (-30.62%)
Mutual labels:  http-client, developer-tools
Httpie
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie
Stars: ✭ 53,052 (+4097.15%)
Mutual labels:  http-client, developer-tools
Http Prompt
An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie
Stars: ✭ 8,329 (+558.94%)
Mutual labels:  http-client, developer-tools
Request Compose
Composable HTTP Client
Stars: ✭ 80 (-93.67%)
Mutual labels:  http-client
Request via
RequestVia: A Functional HTTP Client That Wraps Net::HTTP
Stars: ✭ 74 (-94.15%)
Mutual labels:  http-client
Http Client
The HttpClient component provides powerful methods to fetch HTTP resources synchronously or asynchronously.
Stars: ✭ 1,186 (-6.17%)
Mutual labels:  http-client
Subethaedit
General purpose plain text editor for macOS. Widely known for its live collaboration feature.
Stars: ✭ 1,183 (-6.41%)
Mutual labels:  developer-tools
Http Client
A high-performance, high-stability, cross-platform HTTP client.
Stars: ✭ 86 (-93.2%)
Mutual labels:  http-client
Lighthouse Batch
Run Lighthouse analysis over multiple sites in a single command
Stars: ✭ 83 (-93.43%)
Mutual labels:  developer-tools
Restclient Cpp
C++ client for making HTTP/REST requests
Stars: ✭ 1,206 (-4.59%)
Mutual labels:  http-client
Zeal
Offline documentation browser inspired by Dash
Stars: ✭ 9,164 (+625%)
Mutual labels:  developer-tools
Parse Dashboard For Ios
A beautiful mobile client for managing your Parse apps while you are on the go! Now you can easily view and modify your data in the same way you would on the offical desktop client.
Stars: ✭ 81 (-93.59%)
Mutual labels:  developer-tools
Multiwatch
Simple task runner on directory changes that doesn't produce tons of logs if everything is OK 👌
Stars: ✭ 74 (-94.15%)
Mutual labels:  developer-tools
Dumb Jump
an Emacs "jump to definition" package for 50+ languages
Stars: ✭ 1,256 (-0.63%)
Mutual labels:  developer-tools
Fluentlyhttpclient
Http Client for .NET Standard with fluent APIs which are intuitive, easy to use and also highly extensible.
Stars: ✭ 73 (-94.22%)
Mutual labels:  http-client
Cvise
Super-parallel Python port of the C-Reduce
Stars: ✭ 77 (-93.91%)
Mutual labels:  developer-tools
Envkey App
Secure, human-friendly, cross-platform secrets and config.
Stars: ✭ 83 (-93.43%)
Mutual labels:  developer-tools
Bof
The HTTP client for humans
Stars: ✭ 76 (-93.99%)
Mutual labels:  http-client
Gso
🏃 Google StackOverflow in Vim. Copy-pastes the code directly in your script.
Stars: ✭ 75 (-94.07%)
Mutual labels:  developer-tools

xh

Version info

xh is a friendly and fast tool for sending HTTP requests. It reimplements as much as possible of HTTPie's excellent design.

asciicast

Installation

On macOS and Linux via Homebrew

brew install xh

On windows via Scoop

scoop install xh

On Arch linux via Pacman

pacman -S xh

From binaries

The release page contains prebuilt binaries for Linux, macOS and Windows.

From source

Make sure that you have Rust 1.45 or later installed.

cargo install xh

Usage

USAGE:
    xh [OPTIONS] <[METHOD] URL> [--] [REQUEST_ITEM]...

OPTIONS:
    -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
        --pretty <STYLE>             Controls output processing [possible values: all, colors, format, none]
    -s, --style <THEME>              Output coloring style [possible values: auto, solarized]
    -p, --print <FORMAT>             String specifying what the output should contain
    -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
    -o, --output <FILE>              Save output to FILE instead of stdout
    -d, --download                   Download the body to a file instead of printing it
    -c, --continue                   Resume an interrupted download. Requires --download and --output
    -a, --auth <USER[:PASS]>         Authenticate as USER with PASS. PASS will be prompted if missing
        --bearer <TOKEN>             Authenticate with a bearer token
        --ignore-netrc               Do not use credentials from .netrc
        --offline                    Construct HTTP requests without sending them anywhere
        --check-status               Exit with an error status code if the server replies with an error
    -F, --follow                     Do follow redirects
        --max-redirects <NUM>        Number of redirects to follow, only respected if `follow` is set
        --proxy <PROTOCOL:URL>...    Use a proxy for a protocol. For example: `--proxy https:http://proxy.host:8080`
        --verify <VERIFY>            If "no", skip SSL verification. If a file path, use it as a CA bundle
        --cert <FILE>                Use a client side certificate for SSL
        --cert-key <FILE>            A private key file to use with --cert
        --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
        --curl-long                  Use the long versions of curl's flags
        --help                       Prints help information
    -V, --version                    Prints version information

ARGS:
    <[METHOD] URL>       The request URL, preceded by an optional HTTP method
    <REQUEST_ITEM>...    Optional key-value pairs to be included in the request

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

Run xh help for more detailed information.

Request Items

xh uses HTTPie's request-item syntax to set headers, request body, query string, etc.

  • =/:= for setting the request body's JSON fields (= for strings and := for other JSON types).
  • == for adding query strings.
  • @ for including files in multipart requests e.g [email protected] or [email protected];type=image/jpeg.
  • : for adding or removing headers e.g connection:keep-alive or connection:.
  • ; for including headers with empty values e.g header-without-value;.

xh and xhs

xh will default to HTTPS scheme if the binary name is one of xhs, https, or xhttps. If you have installed xh via a package manager, both xh and xhs should be available by default. Otherwise, you need to create one like this:

$ cd /path/to/xh
$ ln -s ./xh ./xhs

xh httpbin.org/get | jq .url  # "http://httpbin.org/get"
xhs httpbin.org/get | jq .url # "https://httpbin.org/get"

Examples

# Send a GET request
xh httpbin.org/json

# Send a POST request with body {"name": "ahmed", "age": 24}
xh httpbin.org/post name=ahmed age:=24

# Send a GET request with querystring id=5&sort=true
xh get httpbin.org/json id==5 sort==true

# Send a GET request and include a header named x-api-key with value 12345
xh get httpbin.org/json x-api-key:12345

# Send a PUT request and pipe the result to less
xh put httpbin.org/put id:=49 age:=25 | less

# Download and save to res.json
xh -d httpbin.org/json -o res.json

xh vs HTTPie

Advantages over HTTPie

  • Improved startup speed. xh may run short requests many times as fast.
  • Available as a single statically linked binary that's easy to install and carry around.
  • HTTP/2 support.
  • Builtin translation to curl commands with the --curl flag (similar to https://curl2httpie.online/).
  • Short, cheatsheet-style output from --help. (For longer output, pass help.)

Disadvantages

  • Not all of HTTPie's features are implemented. (#4)
  • HTTP/2 cannot be disabled. (#68)
  • Large downloads over HTTP/2 are currently slow. (#49)
  • No plugin system.
  • General immaturity. HTTPie is old and well-tested.
  • Worse documentation.

Other differences

  • rustls is used instead of the system's TLS library.
  • Headers are sent and printed in lowercase.
  • JSON keys are not sorted.

Similar Projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].