Unverified Commit eb4f5b32 authored by Niklas Adolfsson's avatar Niklas Adolfsson Committed by GitHub
Browse files

feat(http client): support tokio02 via hyper 0.13 (#201)

* feat(http client): support tokio02 via hyper 0.13

* fix: address review suggestions.

* [ci]: update to work again

* deps(http client): remove unused hyper features

* grumbles: replace \" with ` in compile_error!
parent 11d40103
......@@ -64,17 +64,17 @@ jobs:
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cargo check no-default-features
- name: Cargo check all targets
uses: actions-rs/cargo@v1
with:
command: check
args: --benches --tests
args: --all-targets
- name: Cargo check all-features
- name: Cargo check HTTP client with tokio02
uses: actions-rs/cargo@v1
with:
command: check
args: --benches --tests --all-features
args: --manifest-path http-client/Cargo.toml --no-default-features --features tokio02
tests:
name: Run tests
......
......@@ -8,9 +8,10 @@ license = "MIT"
[dependencies]
futures = "0.3"
hyper = { version = "0.14", features = ["stream", "client", "server", "http1", "http2", "tcp"] }
hyper14 = { package = "hyper", version = "0.14", features = ["client", "http1", "http2", "tcp"], optional = true }
hyper13 = { package = "hyper", version = "0.13", optional = true }
jsonrpsee-types = { path = "../types", version = "0.1" }
jsonrpsee-utils = { path = "../utils", version = "0.1" }
jsonrpsee-utils = { path = "../utils", version = "0.1", default-features = false, optional = true }
log = "0.4"
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = "1.0"
......@@ -18,6 +19,11 @@ thiserror = "1.0"
unicase = "2.6"
url = "2.2"
[features]
default = ["tokio1"]
tokio1 = ["hyper14", "jsonrpsee-utils/hyper14"]
tokio02 = ["hyper13", "jsonrpsee-utils/hyper13"]
[dev-dependencies]
jsonrpsee-test-utils = { path = "../test-utils" }
tokio = { version = "1.0", features = ["net", "rt-multi-thread", "macros"] }
#[cfg(all(feature = "tokio1", feature = "tokio02"))]
compile_error!("feature `tokio1` and `tokio02` are mutably exclusive");
#[cfg(not(any(feature = "tokio1", feature = "tokio02")))]
compile_error!("feature `tokio1` or `tokio02` must be enabled for this crate");
#[cfg(all(feature = "tokio1", not(feature = "tokio02")))]
extern crate hyper14 as hyper;
#[cfg(all(feature = "tokio02", not(feature = "tokio1")))]
extern crate hyper13 as hyper;
mod client;
mod transport;
......
......@@ -9,12 +9,16 @@ license = "MIT"
[dependencies]
futures = "0.3"
globset = "0.4"
hyper = { version = "0.14", features = ["stream"] }
hyper13 = { package = "hyper", version = "0.13", default-features = false, features = ["stream"], optional = true }
hyper14 = { package = "hyper", version = "0.14", default-features = false, features = ["stream"], optional = true }
jsonrpsee-types = { path = "../types", version = "0.1" }
lazy_static = "1.4"
log = "0.4"
unicase = "2.6"
[features]
default = ["hyper14"]
[dev-dependencies]
serde_json = "1.0"
tokio = { version = "1.0", features = ["macros"] }
......@@ -29,7 +29,7 @@
use crate::http::cors::{AccessControlAllowHeaders, AccessControlAllowOrigin};
use crate::http::hosts::{AllowHosts, Host};
use crate::http::{cors, hosts, hyper_helpers};
use hyper::{self, header};
use hyper::header;
/// Define access on control on http layer
#[derive(Clone)]
......
#[cfg(all(feature = "hyper13", feature = "hyper14"))]
compile_error!("feature `hyper13` and `hyper14` are mutably exclusive");
#[cfg(not(any(feature = "hyper13", feature = "hyper14")))]
compile_error!("feature `hyper13` or `hyper14` must be enabled for this crate");
#[cfg(all(feature = "hyper13", not(feature = "hyper14")))]
extern crate hyper13 as hyper;
#[cfg(all(feature = "hyper14", not(feature = "hyper13")))]
extern crate hyper14 as hyper;
pub mod http;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment