leyline-http 0.1.0

HTTP client that mimics browsers on the wire
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[tokio::main]
async fn main() {
    match leyline::Session::new()
        .get("https://tls.peet.ws/api/all")
        .await
    {
        Ok(resp) => {
            println!("Status: {}", resp.status());
            let text = resp.text().await.unwrap();
            if text.len() > 100 {
                println!("Body: {}... ({} bytes)", &text[..100], text.len());
            }
            println!("\nThat's it: the default Chrome profile, no builder, no config.");
        }
        Err(e) => eprintln!("Error: {e}"),
    }
}