#http #client #request

http_req

simple and lightweight HTTP client with built-in HTTPS support

23 unstable releases (4 breaking)

✓ Uses Rust 2018 edition

0.5.3 Jul 31, 2019
0.5.0 May 12, 2019
0.4.6 Mar 18, 2019
0.4.2 Dec 28, 2018
0.3.1 Nov 21, 2018

#21 in HTTP client

Download history 1336/week @ 2019-04-17 1353/week @ 2019-04-24 808/week @ 2019-05-01 682/week @ 2019-05-08 786/week @ 2019-05-15 998/week @ 2019-05-22 1320/week @ 2019-05-29 1116/week @ 2019-06-05 1424/week @ 2019-06-12 1187/week @ 2019-06-19 1231/week @ 2019-06-26 1316/week @ 2019-07-03 1429/week @ 2019-07-10 1335/week @ 2019-07-17 1574/week @ 2019-07-24

5,051 downloads per month
Used in 22 crates (6 directly)

MIT license

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

License

Licensed under MIT.

Dependencies

~0.2–1.7MB
~43K SLoC