req

Crates.ioreq
lib.rsreq
version0.6.2
sourcesrc
created_at2022-03-18 11:41:34.266105
updated_at2023-05-20 15:56:40.363163
descriptionCommand line http client (like curl). Easier formatting to send JSON bodies, smarter defaults, and more, when compared to curl.
homepage
repository
max_upload_size
id552643
size54,868
Kurt Wolf (kurtbuilds)

documentation

README

GitHub Contributors Stars Build Status

req - HTTP Client

req is a command line HTTP client, like curl, httpie and many others. Why another one? This is probably the most succinct, while still intuitive, client you'll find. Let's see if you agree:

Examples

# Get `localhost:5000/`. We assume localhost if the hostname is a bare port.
req :5000

Let's send some JSON.

req :5000/auth/login --json email=test@example.com password=123
# --json sets `content-type`, sets `accept`, sets method to POST, and interprets the rest of the arguments
# as key-value pairs in JSON. And it pretty-prints and colorizes the JSON response.
# All of that behavior is defaulted, but can be overridden.

You can also use --form which behaves similarly.

Here's a GET request:

# Because its a GET request, we know additional arguments are query params. These arguments get URL encoded.
req :5000/search q='this is a multi-word query string'

Need authentication headers? These all work:

req --bearer <token>
req -u <user>:<pass>  # --user also works
req --token <token>

We keep the -O flag from curl for saving files.

Installation

cargo install --git https://github.com/kurtbuilds/req

Contributions

Need a feature or have a bug report? Open an issue or a PR.

Roadmap

  • Flag to upload a file
Commit count: 0

cargo fmt