HTTP clients

RecipeCratesCategories
reqwestreqwestcat-web-programming::http-client
urequreqcat-web-programming::http-client
hyperhypercat-web-programming::http-client

reqwest

reqwest reqwest-crates.io reqwest-github reqwest-lib.rs

reqwest is a full-fat HTTP client. It can be used in both synchronous and asynchronous code. It requires the tokio runtime.

ureq

ureq ureq-crates.io ureq-github ureq-lib.rs cat-web-programming::http-client

ureq is a minimal synchronous HTTP client, focused on simplicity and minimizing dependencies.


fn main() -> anyhow::Result<()> {
    let url = "https://jsonplaceholder.typicode.com/posts/1";
    let response: String = ureq::get(url).call()?.into_string()?;

    println!("Response: {}", response);
    Ok(())
}

hyper

hyper hyper-crates.io hyper-github hyper-lib.rs

hyper is a low-level HTTP implementation (both client and server). It implements HTTP/1, and HTTP/2. It works best with the tokio async runtime, but can support other runtimes.