File tree 3 files changed +14
-6
lines changed 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,9 @@ edition = "2018"
20
20
# when the default feature set is updated, verify that the `--features` flags in
21
21
# `.github/workflows/ci.yaml` are updated accordingly
22
22
default = [" curl-client" , " middleware-logger" , " encoding" ]
23
- h1-client = [" http-client/h1_client" , " default-client" ]
24
23
curl-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" ]
25
26
wasm-client = [" http-client/wasm_client" , " default-client" ]
26
27
default-client = []
27
28
middleware-logger = []
@@ -34,7 +35,7 @@ log = { version = "0.4.7", features = ["kv_unstable"] }
34
35
mime_guess = " 2.0.3"
35
36
serde = " 1.0.97"
36
37
serde_json = " 1.0.40"
37
- http-client = { version = " 6.0 .0" , default-features = false }
38
+ http-client = { version = " 6.1 .0" , default-features = false }
38
39
http-types = " 2.5.0"
39
40
async-std = { version = " 1.6.0" , default-features = false , features = [" std" ] }
40
41
async-trait = " 0.1.36"
Original file line number Diff line number Diff line change @@ -10,12 +10,18 @@ use cfg_if::cfg_if;
10
10
cfg_if ! {
11
11
if #[ cfg( feature = "curl-client" ) ] {
12
12
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( ) ) ) ;
15
13
} else if #[ cfg( feature = "wasm-client" ) ] {
16
14
use http_client:: wasm:: WasmClient as DefaultClient ;
17
15
} else if #[ cfg( feature = "h1-client" ) ] {
18
16
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( ) ) ) ;
19
25
}
20
26
}
21
27
@@ -137,7 +143,7 @@ impl Client {
137
143
#[ cfg( feature = "default-client" ) ]
138
144
pub ( crate ) fn new_shared ( ) -> Self {
139
145
cfg_if ! {
140
- if #[ cfg( feature = "curl-client" ) ] {
146
+ if #[ cfg( any ( feature = "curl-client" , feature = "hyper-client" ) ) ] {
141
147
Self :: with_http_client_internal( GLOBAL_CLIENT . clone( ) )
142
148
} else {
143
149
Self :: new( )
Original file line number Diff line number Diff line change 64
64
//! # Features
65
65
//! The following features are available. The default features are
66
66
//! `curl-client`, `middleware-logger`, and `encoding`
67
- //! - __`h1-client`:__ use `async-h1` as the HTTP backend.
68
67
//! - __`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.
69
70
//! - __`wasm-client`:__ use `window.fetch` as the HTTP backend.
70
71
//! - __`middleware-logger` (default):__ enables logging requests and responses using a middleware.
71
72
//! - __`encoding` (default):__ enables support for body encodings other than utf-8
You can’t perform that action at this time.
0 commit comments