Skip to content

Commit c554966

Browse files
committed
deps, client: update for HttpClient 6.0
All of the global shared client now uses just one Arc. Refs: http-rs/http-client#48
1 parent 1ea7fbb commit c554966

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ serde = "1.0.97"
3636
serde_json = "1.0.40"
3737
serde_urlencoded = "0.6.1"
3838
url = "2.0.0"
39-
http-client = { version = "5.0.0", default-features = false }
39+
http-client = { git = "https://github.com/Fishrock123/http-client.git", branch = "no-clone", default-features = false }
4040
http-types = "2.0.0"
4141
async-std = { version = "1.6.0", default-features = false, features = ["std"] }
4242
async-trait = "0.1.36"

src/client.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ cfg_if! {
1212
if #[cfg(feature = "curl-client")] {
1313
use http_client::isahc::IsahcClient as DefaultClient;
1414
use once_cell::sync::Lazy;
15-
static GLOBAL_CLIENT: Lazy<http_client::isahc::IsahcClient> =
16-
Lazy::new(http_client::isahc::IsahcClient::new);
15+
static GLOBAL_CLIENT: Lazy<Arc<DefaultClient>> = Lazy::new(|| Arc::new(DefaultClient::new()));
1716
} else if #[cfg(feature = "wasm-client")] {
1817
use http_client::wasm::WasmClient as DefaultClient;
1918
} else if #[cfg(feature = "h1-client")] {
@@ -125,7 +124,7 @@ impl Client {
125124
pub(crate) fn new_shared() -> Self {
126125
cfg_if! {
127126
if #[cfg(feature = "curl-client")] {
128-
Self::with_http_client(GLOBAL_CLIENT.clone())
127+
Self::with_http_client_internal(GLOBAL_CLIENT.clone())
129128
} else {
130129
Self::new()
131130
}

0 commit comments

Comments
 (0)