HTTP GET with reqwest
Async HTTP GET with the popular reqwest crate and tokio runtime.
Author:
chris
// Language: Rust
// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::Error;
#[tokio::main]
async fn main() -> Result<(), Error> {
let body = reqwest::get("https://api.github.com/zen")
.await?
.text()
.await?;
println!("{body}");
Ok(())
}