Sean McArthur 87a09322d6 Make the async Client default (#626)
The previously default Client is moved to `reqwest::blocking`, while the
async client becomes the main API.

Closes #622
2019-09-09 17:20:51 -07:00
2019-09-09 17:20:51 -07:00
2017-10-22 13:27:20 +08:00
2019-09-09 12:45:45 -07:00
2019-09-09 12:45:45 -07:00
2019-07-19 12:23:04 -07:00
2016-06-30 17:23:51 -07:00
2016-12-13 15:47:28 -08:00
2019-09-09 17:20:51 -07:00

reqwest

Travis CI Status Appveyor CI Status crates.io Documentation

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
  • Changelog

Note

: reqwest's master branch is currently preparing breaking changes, for most recently released code, look to the 0.9.x branch.

Example

Async:

use std::collections::HashMap;

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

Blocking:

use std::collections::HashMap;

fn main() -> Result<(), Box<std::error::Error>> {
    let resp: HashMap<String, String> = reqwest::blocking::get("https://httpbin.org/ip")?
        .json()?;
    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.

Description
No description provided
Readme 2 MiB
Languages
Rust 99.6%
Nix 0.4%