#http #client #request

http_req

simple and lightweight HTTP client with built-in HTTPS support

30 releases

0.7.2 Dec 11, 2020
0.7.1 Oct 20, 2020
0.7.0 Jun 20, 2020
0.6.1 Mar 15, 2020
0.3.1 Nov 21, 2018

#8 in HTTP client

Download history 1901/week @ 2020-11-06 1575/week @ 2020-11-13 1719/week @ 2020-11-20 1460/week @ 2020-11-27 1981/week @ 2020-12-04 1532/week @ 2020-12-11 1475/week @ 2020-12-18 1602/week @ 2020-12-25 1439/week @ 2021-01-01 1402/week @ 2021-01-08 1406/week @ 2021-01-15 1759/week @ 2021-01-22 969/week @ 2021-01-29 760/week @ 2021-02-05 947/week @ 2021-02-12 668/week @ 2021-02-19

8,502 downloads per month
Used in 34 crates (13 directly)

MIT license

110KB
2K SLoC

http_req

Build Status Crates.io Docs.rs

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

Requirements

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

Example

Basic GET request

use http_req::request;

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

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

How to use with rustls:

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

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

License

Licensed under MIT.

Dependencies

~0.2–3MB
~64K SLoC