async_minreq 0.1.0

Simple, minimal-dependency HTTP client
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! This example demonstrates the `json-using-serde` feature.

#[tokio::main]
async fn main() -> Result<(), async_minreq::Error> {
    let response = async_minreq::get("http://httpbin.org/anything")
        .with_body("Hello, world!")
        .send()
        .await?;

    // httpbin.org/anything returns the body in the json field "data":
    let json: serde_json::Value = response.json()?;
    println!("\"Hello, world!\" == {}", json["data"]);

    Ok(())
}