| Crates.io | http_req |
| lib.rs | http_req |
| version | 0.14.1 |
| created_at | 2018-09-02 11:20:20.649976+00 |
| updated_at | 2025-07-27 14:27:38.367342+00 |
| description | simple and lightweight HTTP client with built-in HTTPS support |
| homepage | |
| repository | https://github.com/jayjamesjay/http_req |
| max_upload_size | |
| id | 82611 |
| size | 683,969 |
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 rustls.
Request type (with extended capabilities provided via RequestMessage and Stream)Response type, allowing easy access to details like the status code and headersRedirectPolicyTransfer-Encoding: chunkedUris and partial support for relative UrisError handling system allowing for better debuggingget, head, postIn order to use http_req with default configuration, add the following lines to Cargo.toml:
[dependencies]
http_req = "^0.14"
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"] }
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 }
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
Licensed under MIT.