Skip to content

Commit 06994bb

Browse files
authored
Merge pull request #65 from vessd/fix-hyper
Fix build and tests for the 'hyper_client' feature.
2 parents 69cdd5d + ec039a4 commit 06994bb

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "Types and traits for http clients."
88
keywords = ["http", "service", "client", "futures", "async"]
99
categories = ["asynchronous", "web-programming", "web-programming::http-client", "web-programming::websocket"]
1010
authors = [
11-
"Yoshua Wuyts <yoshuawuyts@gmail.com>",
11+
"Yoshua Wuyts <yoshuawuyts@gmail.com>",
1212
"dignifiedquire <me@dignifiedquire.com>",
1313
"Jeremiah Senkpiel <fishrock123@rocketmail.com>"
1414
]
@@ -45,7 +45,7 @@ async-tls = { version = "0.10.0", optional = true }
4545
# hyper_client
4646
hyper = { version = "0.13.6", features = ["tcp"], optional = true }
4747
hyper-tls = { version = "0.4.3", optional = true }
48-
futures-util = { version = "0.3.5", optional = true }
48+
futures-util = { version = "0.3.5", features = ["io"], optional = true }
4949

5050
# curl_client
5151
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

tests/test.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ use http_types::{Body, Request, Response, Url};
55

66
use cfg_if::cfg_if;
77

8+
cfg_if! {
9+
if #[cfg(not(feature = "hyper_client"))] {
10+
use async_std::test as atest;
11+
} else {
12+
use tokio::test as atest;
13+
}
14+
}
15+
816
cfg_if! {
917
if #[cfg(feature = "curl_client")] {
1018
use http_client::isahc::IsahcClient as DefaultClient;
@@ -17,7 +25,7 @@ cfg_if! {
1725
}
1826
}
1927

20-
#[async_std::test]
28+
#[atest]
2129
async fn post_json() -> Result<(), http_types::Error> {
2230
#[derive(serde::Deserialize, serde::Serialize)]
2331
struct Cat {
@@ -45,7 +53,7 @@ async fn post_json() -> Result<(), http_types::Error> {
4553
Ok(())
4654
}
4755

48-
#[async_std::test]
56+
#[atest]
4957
async fn get_json() -> Result<(), http_types::Error> {
5058
#[derive(serde::Deserialize)]
5159
struct Message {
@@ -66,7 +74,7 @@ async fn get_json() -> Result<(), http_types::Error> {
6674
Ok(())
6775
}
6876

69-
#[async_std::test]
77+
#[atest]
7078
async fn get_google() -> Result<(), http_types::Error> {
7179
let url = "https://www.google.com";
7280
let req = Request::new(http_types::Method::Get, Url::parse(url).unwrap());
@@ -90,7 +98,7 @@ async fn get_google() -> Result<(), http_types::Error> {
9098
Ok(())
9199
}
92100

93-
#[async_std::test]
101+
#[atest]
94102
async fn get_github() -> Result<(), http_types::Error> {
95103
let url = "https://raw.githubusercontent.com/http-rs/surf/6627d9fc15437aea3c0a69e0b620ae7769ea6765/LICENSE-MIT";
96104
let req = Request::new(http_types::Method::Get, Url::parse(url).unwrap());

0 commit comments

Comments
 (0)