You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
async-std/examples/surf-web.rs

19 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(())
})
}