2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-01-16 02:39:55 +00:00
async-std/examples/surf-web.rs
2020-10-20 14:45:37 +02:00

18 lines
459 B
Rust

use async_std::task;
fn main() -> Result<(), surf::Error> {
task::block_on(async {
let url = "https://www.rust-lang.org";
let mut response = surf::get(url).send().await?;
let body = response.body_string().await?;
dbg!(url);
dbg!(response.status());
dbg!(response.version());
dbg!(response.header_names());
dbg!(response.header_values());
dbg!(body.len());
Ok(())
})
}