Simple blocking http client



cargo add reqwest --features blocking


examples/reqwest/simple-http-client/Cargo.toml
[package]
name = "simple-http-client"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
reqwest = { version = "0.11.20", features = ["blocking"] }

examples/reqwest/simple-http-client/src/main.rs
fn main() {
    let res = match reqwest::blocking::get("https://httpbin.org/ip") {
        Ok(res) => res,
        Err(err) => {
            println!("Error {}", err);
            std::process::exit(1);
        }
    };
    println!("{:?}", res.status());
    println!("{:?}", res);
}