Skip to content

Commit

Permalink
update surf
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
  • Loading branch information
Keruspe committed Oct 18, 2020
1 parent beef46e commit 7274fea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ pin-utils = { version = "0.1.0-alpha.4", optional = true }
slab = { version = "0.4.2", optional = true }

# Devdepencency, but they are not allowed to be optional :/
surf = { version = "1.0.3", optional = true }
http-types = { version = "2.6.0", optional = true }
surf = { version = "2.0.0", optional = true }

[target.'cfg(not(target_os = "unknown"))'.dependencies]
async-global-executor = { version = "1.4.0", optional = true, features = ["async-io"] }
Expand Down Expand Up @@ -109,4 +110,4 @@ required-features = ["unstable"]

[[example]]
name = "surf-web"
required-features = ["surf"]
required-features = ["http-types", "surf"]
7 changes: 4 additions & 3 deletions examples/surf-web.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use async_std::task;

fn main() -> Result<(), surf::Exception> {
fn main() -> Result<(), http_types::Error> {
task::block_on(async {
let url = "https://www.rust-lang.org";
let mut response = surf::get(url).await?;
let mut response = surf::get(url).send().await?;
let body = response.body_string().await?;

dbg!(url);
dbg!(response.status());
dbg!(response.version());
dbg!(response.headers());
dbg!(response.header_names());
dbg!(response.header_values());
dbg!(body.len());

Ok(())
Expand Down

0 comments on commit 7274fea

Please sign in to comment.