Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Created November 28, 2025 23:35
Show Gist options
  • Select an option

  • Save masakielastic/a2f6b6dcbb91cb9b23a90a19aac05c64 to your computer and use it in GitHub Desktop.

Select an option

Save masakielastic/a2f6b6dcbb91cb9b23a90a19aac05c64 to your computer and use it in GitHub Desktop.

reqwest

cargo run
[package]
name = "reqwest-project"
version = "0.1.0"
edition = "2024"
[dependencies]
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "json"] }
tokio = { version = "1", features = ["full"] }
use reqwest::Error;
#[tokio::main]
async fn main() -> Result<(), Error> {
let url = "https://httpbin.org/get";
let response = reqwest::get(url).await?;
let body = response.text().await?;
println!("{body}");
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment