2 releases

0.11.20 Jan 8, 2024
0.11.16 Apr 12, 2023

#42 in HTTP client

Download history 499/week @ 2023-12-23 978/week @ 2023-12-30 2006/week @ 2024-01-06 1625/week @ 2024-01-13 1265/week @ 2024-01-20 1512/week @ 2024-01-27 1869/week @ 2024-02-03 1900/week @ 2024-02-10 1278/week @ 2024-02-17 1889/week @ 2024-02-24 1802/week @ 2024-03-02 1887/week @ 2024-03-09 2035/week @ 2024-03-16 1859/week @ 2024-03-23 1767/week @ 2024-03-30 1448/week @ 2024-04-06

7,560 downloads per month

MIT/Apache

555KB
11K SLoC

cf-reqwest

crates.io Documentation MIT/Apache-2 licensed CI

An ergonomic, batteries-included HTTP Client for Rust.

  • Plain bodies, JSON, urlencoded, multipart
  • Customizable redirect policy
  • HTTP Proxies
  • HTTPS via system-native TLS (or optionally, rustls)
  • Cookie Store
  • WASM
  • Changelog

About this fork

This is a fork of the great reqwest library with some features that were not accepted to the upstream:

We advice to use the upstream version of the library, unless you need any of those features.

Example

This asynchronous example uses Tokio and enables some optional features, so your Cargo.toml could look like this:

[dependencies]
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1", features = ["full"] }

And then the code:

use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let resp = reqwest::get("https://httpbin.org/ip")
        .await?
        .json::<HashMap<String, String>>()
        .await?;
    println!("{:#?}", resp);
    Ok(())
}

Blocking Client

There is an optional "blocking" client API that can be enabled:

[dependencies]
reqwest = { version = "0.11", features = ["blocking", "json"] }
use std::collections::HashMap;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let resp = reqwest::blocking::get("https://httpbin.org/ip")?
        .json::<HashMap<String, String>>()?;
    println!("{:#?}", resp);
    Ok(())
}

Requirements

On Linux:

On Windows and macOS:

  • Nothing.

Reqwest uses rust-native-tls, which will use the operating system TLS framework if available, meaning Windows and macOS. On Linux, it will use OpenSSL 1.1.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~3–24MB
~421K SLoC