[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 std::env;

use attohttpc::Result;

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

    let url: String = env::args().collect::<Vec<_>>().into_iter().nth(1).expect("missing url");

    let resp = attohttpc::get(&url).send()?;
    println!("Status: {:?}", resp.status());
    println!("Headers:\n{:#?}", resp.headers());
    println!("Body:\n{}", resp.text()?);

    Ok(())
}