mirror of
https://github.com/async-rs/async-std.git
synced 2025-01-16 02:39:55 +00:00
parent
3b9ee1ad48
commit
e9e3754402
3 changed files with 23 additions and 0 deletions
|
@ -14,6 +14,7 @@ matrix:
|
|||
env: BUILD_DOCS=1
|
||||
- rust: nightly
|
||||
os: osx
|
||||
osx_image: xcode9.2
|
||||
env: BUILD_DOCS=1
|
||||
- rust: nightly-x86_64-pc-windows-msvc
|
||||
os: windows
|
||||
|
|
|
@ -36,6 +36,7 @@ mio-uds = "0.6.7"
|
|||
num_cpus = "1.10.0"
|
||||
pin-utils = "0.1.0-alpha.4"
|
||||
slab = "0.4.2"
|
||||
surf = "1.0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
femme = "1.1.0"
|
||||
|
|
21
examples/surf-web.rs
Normal file
21
examples/surf-web.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
//! Sends an HTTP request to the 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 a new issue