8000 GitHub - c2vi/http_req: simple HTTP client with built-in HTTPS support
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

c2vi/http_req

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http_req

Caution

v0.12.0 replaces RequestBuilder with RequestMessage. Please review documentation before migrating from previous versions.

Rust Crates.io Docs.rs

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

  • HTTP and HTTPS via rust-native-tls (or optionally rus-tls)
  • Small binary size (less than 0.7 MB for basic GET request)
  • Minimal amount of dependencies

Requirements

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.

Example

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

How to use with rustls:

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

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

License

Licensed under MIT.

About

simple HTTP client with built-in HTTPS support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%
0