Simple and lightweight HTTP client with built-in HTTPS support.
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 rus-tls.
Basic HTTP GET request
use http_req::request;fnmain(){letmut 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
In order to use http_req with rustls in your project, add the following lines to Cargo.toml:
[dependencies]
http_req = {version="^0.10", default-features = false, features = ["rust-tls"]}Licensed under MIT.