[go: up one dir, main page]

attohttpc 0.4.1

Small and lightweight HTTP client
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use serde_json::json;

fn main() -> attohttpc::Result {
    env_logger::init();

    let body = json!({
        "hello": "world",
    });

    let resp = attohttpc::post("http://httpbin.org/post").json(&body)?.send()?;
    println!("Status: {:?}", resp.status());
    println!("Headers:\n{:#?}", resp.headers());
    println!("Body:\n{}", resp.text_utf8()?);

    Ok(())
}