Skip to content

Commit 6092065

Browse files
committed
client: make global client work with non-Clone HttpClient
Uses http-rs/http-client#48
1 parent 8cbd454 commit 6092065

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Cargo.toml

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

src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cfg_if! {
2222
cfg_if! {
2323
if #[cfg(any(feature = "curl-client", feature = "hyper-client"))] {
2424
use once_cell::sync::Lazy;
25-
static GLOBAL_CLIENT: Lazy<DefaultClient> = Lazy::new(DefaultClient::new);
25+
static GLOBAL_CLIENT: Lazy<Arc<DefaultClient>> = Lazy::new(|| Arc::new(DefaultClient::new()));
2626
}
2727
}
2828

@@ -127,7 +127,7 @@ impl Client {
127127
pub(crate) fn new_shared() -> Self {
128128
cfg_if! {
129129
if #[cfg(any(feature = "curl-client", feature = "hyper-client"))] {
130-
Self::with_http_client(Arc::new(GLOBAL_CLIENT.clone()))
130+
Self::with_http_client(GLOBAL_CLIENT.clone())
131131
} else {
132132
Self::new()
133133
}

0 commit comments

Comments
 (0)