How to make HTTP requests with reqwest

Make HTTP requests in Rust by adding the reqwest crate and calling reqwest::get() with an async runtime.

Use the reqwest crate with the rustls-tls feature to make HTTP requests asynchronously. Add reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] } to your Cargo.toml, then call reqwest::get() and await the response text.

use trpl::get;

#[tokio::main]
async fn main() {
    let response = get("https://www.rust-lang.org").await;
    let body = response.text().await;
    println!("{body}");
}