http_req

simple HTTP client with built-in HTTPS support

Latest version: 0.14.4 registry icon
Maintenance score
56
Safety score
100
Popularity score
74
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.14.4 0 0 0 0 0
0.14.3 0 0 0 0 0
0.14.2 0 0 0 0 0
0.14.1 0 0 0 0 0
0.14.0 0 0 0 0 0
0.13.3 0 0 0 0 0
0.13.2 0 0 0 0 0
0.13.1 0 0 0 0 0
0.13.0 0 0 0 0 0
0.12.0 0 0 0 0 0
0.11.1 0 0 0 0 0
0.11.0 0 0 0 0 0
0.10.3 0 0 0 0 0
0.10.2 0 0 0 0 0
0.10.1 0 0 0 0 0
0.10.0 0 0 0 0 0
0.9.3 0 0 0 0 0
0.9.2 0 0 0 0 0
0.9.1 0 0 0 0 0
0.9.0 0 0 0 0 0
0.8.1 0 0 0 0 0
0.8.0 0 0 0 0 0
0.7.2 0 0 0 0 0
0.7.1 0 0 0 0 0
0.7.0 0 0 0 0 0
0.6.1 0 0 0 0 0
0.6.0 0 0 0 0 0
0.5.5 0 0 0 0 0
0.5.4 0 0 0 0 0
0.5.3 0 0 0 0 0
0.5.2 0 0 0 0 0
0.5.1 0 0 0 0 0
0.5.0 0 0 0 0 0
0.4.11 0 0 0 0 0
0.4.10 0 0 0 0 0
0.4.9 0 0 0 0 0
0.4.8 0 0 0 0 0
0.4.7 0 0 0 0 0
0.4.6 0 0 0 0 0
0.4.5 0 0 0 0 0
0.4.4 0 0 0 0 0
0.4.3 0 0 0 0 0
0.4.2 0 0 0 0 0
0.4.1 0 0 0 0 0
0.4.0 0 0 0 0 0
0.3.1 0 0 0 0 0
0.3.0 0 0 0 0 0
0.2.1 0 0 0 0 0
0.2.0 0 0 0 0 0
0.1.2 0 0 0 0 0
0.1.1 0 0 0 0 0
0.1.0 0 0 0 0 0

Stability
Latest release:

0.14.4 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



http_req

Rust Crates.io Docs.rs

Simple and lightweight HTTP client with built-in HTTPS support.

  • HTTP and HTTPS via rust-native-tls (or optionally rustls)
  • Small binary size (0.7 MB for a basic GET request in the default configuratio)
  • Minimal number of dependencies

Requirements

http_req by default uses rust-native-tls, which relies on TLS framework provided by OS on Windows and macOS, and OpenSSL on all other platforms. But it also supports rustls.

All functionalities

  • Support for both HTTP and HTTPS protocols via rust-native-tls (or optionally rustls)
  • Creating and sending HTTP requests using the Request type (with extended capabilities provided via RequestMessage and Stream)
  • Representing HTTP responses with the Response type, allowing easy access to details like the status code and headers
  • Handling redirects using the RedirectPolicy
  • Support for Basic and Bearer authentication
  • Processing responses with Transfer-Encoding: chunked
  • Managing absolute Uris and partial support for relative Uris
  • Enforcing timeouts on requests
  • Downloading data in a streaming fashion, allowing direct saving to disk (minimizing RAM usage)
  • Error handling system allowing for better debugging
  • Utility functions for easily sending common request types: get, head, post

Usage

Default configuration

In order to use http_req with default configuration, add the following lines to Cargo.toml:

[dependencies]
http_req = "^0.14"

Rustls

In order to use http_req with rustls in your project, add the following lines to Cargo.toml:

[dependencies]
http_req = { version="^0.14", default-features = false, features = ["rust-tls"] }

HTTP only

In order to use http_req without any additional features in your project (no HTTPS, no Authentication), add the following lines to Cargo.toml:

[dependencies]
http_req = { version="^0.14", default-features = false }

Example

Basic HTTP GET request

use http_req::request;

fn main() {
    let mut body = Vec::new(); //Container for body of a response.
    let res = request::get("https://doc.rust-lang.org/", &mut body).unwrap();

    println!("Status: {} {}", res.status_code(), res.reason());
}

Take a look at more examples

License

Licensed under MIT.