HTTP Clients
Recipe | Crates | Categories |
---|---|---|
reqwest | ||
ureq | ||
Build a HTTP Client with hyper |
reqwest
reqwest
⮳ is a full-fat HTTP client. It can be used in both synchronous and asynchronous code. It requires the tokio
⮳ runtime.
// COMING SOON
ureq
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()?.body_mut().read_to_string()?; println!("Response: {}", response); Ok(()) }
Build a HTTP Client with hyper
hyper
⮳ is a HTTP/1 and HTTP/2 implementation (both client and server) that works best with the tokio
⮳ async runtime, but can support other runtimes.
hyper
⮳ is meant to be a low-level building block and is indeed used by higher-level libraries such as curl
⮳, reqwest
⮳, and aws-sdk
. You will likely reach for hyper
⮳ to design such tools or access to bleeding-edge features (like HTTP/3).
// // COMING SOON