forked from mirror/async-std
parent
c3a52c2ff3
commit
e8e82c6b71
@ -1,21 +0,0 @@
|
|||||||
//! Creates a HTTP request to the official Rust website.
|
|
||||||
|
|
||||||
#![feature(async_await)]
|
|
||||||
|
|
||||||
use async_std::task;
|
|
||||||
|
|
||||||
fn main() -> Result<(), surf::Exception> {
|
|
||||||
task::block_on(async {
|
|
||||||
let url = "https://www.rust-lang.org";
|
|
||||||
let mut response = surf::get(url).await?;
|
|
||||||
let body = response.body_string().await?;
|
|
||||||
|
|
||||||
dbg!(url);
|
|
||||||
dbg!(response.status());
|
|
||||||
dbg!(response.version());
|
|
||||||
dbg!(response.headers());
|
|
||||||
dbg!(body.len());
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
Reference in New Issue