#http #client #request

http_req

simple and lightweight HTTP client with built-in HTTPS support

32 releases

0.8.1 Jul 7, 2021
0.7.2 Dec 11, 2020
0.7.1 Oct 20, 2020
0.7.0 Jun 20, 2020
0.3.1 Nov 21, 2018

#12 in HTTP client

Download history 947/week @ 2021-04-05 710/week @ 2021-04-12 622/week @ 2021-04-19 645/week @ 2021-04-26 953/week @ 2021-05-03 690/week @ 2021-05-10 657/week @ 2021-05-17 590/week @ 2021-05-24 849/week @ 2021-05-31 625/week @ 2021-06-07 668/week @ 2021-06-14 545/week @ 2021-06-21 637/week @ 2021-06-28 638/week @ 2021-07-05 735/week @ 2021-07-12 630/week @ 2021-07-19

2,907 downloads per month
Used in 39 crates (16 directly)

MIT license

110KB
2.5K SLoC

http_req

Rust 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.8", default-features = false, features = ["rust-tls"]}

License

Licensed under MIT.

Dependencies

~0.2–2.8MB
~64K SLoC