From 7274feae2265a9317aad8ff73809243cbd9e4cbb Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Sun, 18 Oct 2020 09:12:36 +0200 Subject: [PATCH] update surf Signed-off-by: Marc-Antoine Perennou --- Cargo.toml | 5 +++-- examples/surf-web.rs | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2342aa7f6..42cfaff1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] } @@ -109,4 +110,4 @@ required-features = ["unstable"] [[example]] name = "surf-web" -required-features = ["surf"] +required-features = ["http-types", "surf"] diff --git a/examples/surf-web.rs b/examples/surf-web.rs index df139e5b5..5cda84aef 100644 --- a/examples/surf-web.rs +++ b/examples/surf-web.rs @@ -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(())