cargo run
Created
November 28, 2025 23:35
-
-
Save masakielastic/a2f6b6dcbb91cb9b23a90a19aac05c64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [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"] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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