HTTP clients
[http_clients.incl: titles (P1)](https://github.com/john-cd/rust_howto/issues/503)
reqwest
reqwest
is a full-fat HTTP client. It can be used in both synchronous and asynchronous code. It requires the tokio
runtime.
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()?.into_string()?; println!("Response: {}", response); Ok(()) }
hyper
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.
[http_clients: expand (P1)](https://github.com/john-cd/rust_howto/issues/504)