We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5dd0ab0 commit 62be014Copy full SHA for 62be014
Cargo.toml
@@ -35,5 +35,5 @@ slab = "0.4.2"
35
36
[dev-dependencies]
37
femme = "1.1.0"
38
-# surf = { git = "ssh://github.com/yoshuawuyts/surf" }
+surf = "1.0.1"
39
tempdir = "0.3.7"
examples/fetch-html.rs
examples/surf-web.rs
@@ -0,0 +1,21 @@
1
+//! Creates a web request to the Rust website.
2
+
3
+#![feature(async_await)]
4
5
+use async_std::task;
6
7
+fn main() -> Result<(), surf::Exception> {
8
+ task::block_on(async {
9
+ let url = "https://www.rust-lang.org";
10
+ let mut response = surf::get(url).await?;
11
+ let body = response.body_string().await?;
12
13
+ dbg!(url);
14
+ dbg!(response.status());
15
+ dbg!(response.version());
16
+ dbg!(response.headers());
17
+ dbg!(body.len());
18
19
+ Ok(())
20
+ })
21
+}
0 commit comments