File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,9 @@ edition = "2018"
2020# when the default feature set is updated, verify that the `--features` flags in
2121# `.github/workflows/ci.yaml` are updated accordingly
2222default = [" curl-client" , " middleware-logger" , " encoding" ]
23- h1-client = [" http-client/h1_client" , " default-client" ]
2423curl-client = [" http-client/curl_client" , " once_cell" , " default-client" ]
24+ h1-client = [" http-client/h1_client" , " default-client" ]
25+ hyper-client = [" http-client/hyper_client" , " once_cell" , " default-client" , " async-std/tokio02" ]
2526wasm-client = [" http-client/wasm_client" , " default-client" ]
2627default-client = []
2728middleware-logger = []
@@ -34,7 +35,7 @@ log = { version = "0.4.7", features = ["kv_unstable"] }
3435mime_guess = " 2.0.3"
3536serde = " 1.0.97"
3637serde_json = " 1.0.40"
37- http-client = { version = " 6.0 .0" , default-features = false }
38+ http-client = { version = " 6.1 .0" , default-features = false }
3839http-types = " 2.5.0"
3940async-std = { version = " 1.6.0" , default-features = false , features = [" std" ] }
4041async-trait = " 0.1.36"
Original file line number Diff line number Diff line change @@ -10,12 +10,18 @@ use cfg_if::cfg_if;
1010cfg_if ! {
1111 if #[ cfg( feature = "curl-client" ) ] {
1212 use http_client:: isahc:: IsahcClient as DefaultClient ;
13- use once_cell:: sync:: Lazy ;
14- static GLOBAL_CLIENT : Lazy <Arc <DefaultClient >> = Lazy :: new( || Arc :: new( DefaultClient :: new( ) ) ) ;
1513 } else if #[ cfg( feature = "wasm-client" ) ] {
1614 use http_client:: wasm:: WasmClient as DefaultClient ;
1715 } else if #[ cfg( feature = "h1-client" ) ] {
1816 use http_client:: h1:: H1Client as DefaultClient ;
17+ } else if #[ cfg( feature = "hyper-client" ) ] {
18+ use http_client:: hyper:: HyperClient as DefaultClient ;
19+ }
20+ }
21+ cfg_if ! {
22+ if #[ cfg( any( feature = "curl-client" , feature = "hyper-client" ) ) ] {
23+ use once_cell:: sync:: Lazy ;
24+ static GLOBAL_CLIENT : Lazy <Arc <DefaultClient >> = Lazy :: new( || Arc :: new( DefaultClient :: new( ) ) ) ;
1925 }
2026}
2127
@@ -137,7 +143,7 @@ impl Client {
137143 #[ cfg( feature = "default-client" ) ]
138144 pub ( crate ) fn new_shared ( ) -> Self {
139145 cfg_if ! {
140- if #[ cfg( feature = "curl-client" ) ] {
146+ if #[ cfg( any ( feature = "curl-client" , feature = "hyper-client" ) ) ] {
141147 Self :: with_http_client_internal( GLOBAL_CLIENT . clone( ) )
142148 } else {
143149 Self :: new( )
Original file line number Diff line number Diff line change 6464//! # Features
6565//! The following features are available. The default features are
6666//! `curl-client`, `middleware-logger`, and `encoding`
67- //! - __`h1-client`:__ use `async-h1` as the HTTP backend.
6867//! - __`curl-client` (default):__ use `curl` (through `isahc`) as the HTTP backend.
68+ //! - __`h1-client`:__ use `async-h1` as the HTTP backend.
69+ //! - __`hyper-client`:__ use `hyper` (hyper.rs) as the HTTP backend.
6970//! - __`wasm-client`:__ use `window.fetch` as the HTTP backend.
7071//! - __`middleware-logger` (default):__ enables logging requests and responses using a middleware.
7172//! - __`encoding` (default):__ enables support for body encodings other than utf-8
You can’t perform that action at this time.
0 commit comments