Dec 30 2019

reqwest v0.10

reqwest is a higher-level HTTP client for Rust. Let me introduce you the v0.10 release that adds async/await support!

Some headline features are:

  • Add std::future::Future support (hello async/await).
  • Add experimental WASM support.
  • Change the default client API to async, moving the previous synchronous API to reqwest::blocking.
  • Make many “extra” features optional to reduce unnecessary dependencies (blocking, cookies, gzip, json, etc).
  • Enable automatic “system” proxy detection.

Here’s a simple streaming example using the new syntax:

async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let mut resp = reqwest::get("https://hyper.rs").await?;

    while let Some(chunk) = resp.chunk().await? {
        stdout().write_all(&chunk).await?;
    }

    Ok(())
} 

I want to thank all those contributing to make the best Rust HTTP client even better!

Take a look at the changelog for all the details.

  • #rust
  • #rust-lang
  • #http
  • #reqwest
  • #programming