diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 857f346..fb57b86 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,6 +18,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] rust: [nightly] + backend: [native-client, h1-client] steps: - uses: actions/checkout@master @@ -44,7 +45,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --all + args: --all --no-default-features --features '${{ matrix.backend }} middleware-logger encoding' check_fmt_and_docs: name: Checking fmt and docs diff --git a/Cargo.toml b/Cargo.toml index 1d8405a..b27865b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,14 +12,16 @@ readme = "README.md" edition = "2018" [features] +# when the default feature set is updated, verify that the `--features` flags in +# `.github/workflows/ci.yaml` are updated accordingly default = ["native-client", "middleware-logger", "encoding"] -h1-client = ["async-h1", "wasm-client"] +h1-client = ["wasm-client", "http-client/h1_client"] native-client = ["curl-client", "wasm-client", "http-client/native_client"] -hyper-client = ["hyper", "hyper-tls", "native-tls", "runtime", "runtime-raw", "runtime-tokio" ] -curl-client = ["isahc"] -wasm-client = ["js-sys", "web-sys", "wasm-bindgen", "wasm-bindgen-futures"] +curl-client = ["http-client/curl_client"] +wasm-client = ["http-client/wasm_client"] middleware-logger = [] -encoding = ["encoding_rs"] +# requires web-sys for TextDecoder on wasm +encoding = ["encoding_rs", "web-sys"] [dependencies] futures = { version = "0.3.1", features = ["compat", "io-compat"] } @@ -33,49 +35,18 @@ serde_urlencoded = "0.6.1" url = "2.0.0" http-client = "2.0.0" async-std = { version = "1.4.0", default-features = false, features = ["std"] } - -# h1-client -async-h1 = { version = "1.0.0", optional = true } pin-project-lite = "0.1.1" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # encoding encoding_rs = { version = "0.8.20", optional = true } -# isahc-client -isahc = { version = "0.8", optional = true, default-features = false, features = ["http2"] } - -# hyper-client -hyper = { version = "0.13.2", optional = true, default-features = false } -hyper-tls = { version = "0.3.2", optional = true } -native-tls = { version = "0.2.2", optional = true } -runtime = { version = "0.3.0-alpha.8", optional = true } -runtime-raw = { version = "0.3.0-alpha.4", optional = true } -runtime-tokio = { version = "0.3.0-alpha.6", optional = true } - # wasm-client -[target.'cfg(target_arch = "wasm32")'.dependencies] -js-sys = { version = "0.3.25", optional = true } -wasm-bindgen = { version = "0.2.48", optional = true } -wasm-bindgen-futures = { version = "0.4.5", optional = true } - [target.'cfg(target_arch = "wasm32")'.dependencies.web-sys] version = "0.3.25" optional = true features = [ - "AbortSignal", - "Headers", - "ObserverCallback", - "ReferrerPolicy", - "Request", - "RequestCache", - "RequestCredentials", - "RequestInit", - "RequestMode", - "RequestRedirect", - "Response", "TextDecoder", - "Window", ] [dev-dependencies] @@ -83,3 +54,6 @@ async-std = { version = "1.0", features = ["attributes"] } femme = "1.1.0" serde = { version = "1.0.97", features = ["derive"] } mockito = "0.23.3" + +[target.'cfg(target_arch = "wasm32")'.dev-dependencies] +wasm-bindgen = "0.2.48" diff --git a/src/lib.rs b/src/lib.rs index c6513b4..4f6e098 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,7 +65,6 @@ //! - __`native-client` (default):__ use `curl` on the server and `window.fetch` in the browser. //! - __`middleware-logger` (default):__ enables logging requests and responses using a middleware. //! - __`curl-client`:__ use `curl` (through `isahc`) as the HTTP backend. -//! - __`hyper-client`:__ use `hyper` as the HTTP backend. //! - __`wasm-client`:__ use `window.fetch` as the HTTP backend. #![forbid(rust_2018_idioms)]