reqwest — HTTP client.
Basic:
1use reqwest;23#[tokio::main]4async fn main() -> Result<(), reqwest::Error> {5 let resp = reqwest::get("https://httpbin.org/ip").await?;6 let body = resp.text().await?;7 println!("{}", body);8 Ok(())9}
POST with JSON:
1let client = reqwest::Client::new();2let resp = client3 .post("https://api.example.com/users")4 .json(&serde_json::json!({ "name": "Alice" }))5 .send()6 .await?;
Key: reqwest for HTTP, with async/await.