From 8910d88dfc857deaf4c1ddd2fbb3f90c7261c22b Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Tue, 2 Mar 2021 23:24:51 +0800 Subject: [PATCH 1/3] (feat) update hyper to 0.14 --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index df6c669..aa82a61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,8 +50,8 @@ futures = { version = "0.3.8", optional = true } async-tls = { version = "0.10.0", optional = true } # hyper_client -hyper = { version = "0.13.6", features = ["tcp"], optional = true } -hyper-tls = { version = "0.4.3", optional = true } +hyper = { version = "0.14.4", features = ["tcp", "client"], optional = true } +hyper-tls = { version = "0.5.0", optional = true } futures-util = { version = "0.3.5", features = ["io"], optional = true } # curl_client From f03da6ad70a9f051d645007631105573ca3b237d Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Wed, 3 Mar 2021 22:00:04 +0800 Subject: [PATCH 2/3] (fix) fix features flags of hyper 0.14 and tokio 1 --- Cargo.toml | 5 +++-- src/hyper.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index aa82a61..4b0b2a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ futures = { version = "0.3.8", optional = true } async-tls = { version = "0.10.0", optional = true } # hyper_client -hyper = { version = "0.14.4", features = ["tcp", "client"], optional = true } +hyper = { version = "0.14.4", features = ["tcp", "client", "stream", "http1", "http2"], optional = true } hyper-tls = { version = "0.5.0", optional = true } futures-util = { version = "0.3.5", features = ["io"], optional = true } @@ -89,7 +89,8 @@ async-std = { version = "1.6.0", features = ["unstable", "attributes"] } portpicker = "0.1.0" tide = { version = "0.15.0", default-features = false, features = ["h1-server"] } tide-rustls = { version = "0.1.4" } -tokio = { version = "0.2.21", features = ["macros"] } +tokio = { version = "1", features = ["macros", "time"] } serde = "1.0" serde_json = "1.0" mockito = "0.23.3" +hyper = { version = "0.14.4", features = ["server"] } diff --git a/src/hyper.rs b/src/hyper.rs index f88ee8a..01c667a 100644 --- a/src/hyper.rs +++ b/src/hyper.rs @@ -177,7 +177,7 @@ mod tests { req.set_body("hello"); let client = async move { - tokio::time::delay_for(Duration::from_millis(100)).await; + tokio::time::sleep(Duration::from_millis(100)).await; let mut resp = client.send(req).await?; send.send(()).unwrap(); assert_eq!(resp.body_string().await?, "hello"); From 0a03b018261c76f0bd888eb81c283abe41573334 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Thu, 4 Mar 2021 22:21:36 +0800 Subject: [PATCH 3/3] (fix) add hack to turn on js feature for webassembly --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 4b0b2a6..9c60471 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,6 +84,10 @@ features = [ "WorkerGlobalScope", ] +[target.'cfg(target_arch = "wasm32")'.dependencies.getrandom] +version = "0.2.2" +features = ["js"] + [dev-dependencies] async-std = { version = "1.6.0", features = ["unstable", "attributes"] } portpicker = "0.1.0"