From fea3dec9bfc5a876a96a3b1667d1a04a41275202 Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Tue, 9 Apr 2024 20:15:09 +0800 Subject: [PATCH] feat: add `HttpClient::with()` constructor Signed-off-by: Ruihang Xia --- core/src/raw/http_util/client.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/raw/http_util/client.rs b/core/src/raw/http_util/client.rs index 7a3de0ef694..3132d914ccb 100644 --- a/core/src/raw/http_util/client.rs +++ b/core/src/raw/http_util/client.rs @@ -55,6 +55,11 @@ impl HttpClient { Self::build(reqwest::ClientBuilder::new()) } + /// Construct `Self` with given [`reqwest::Client`] + pub fn with(client: reqwest::Client) -> Self { + Self { client } + } + /// Build a new http client in async context. #[cfg(not(target_arch = "wasm32"))] pub fn build(builder: reqwest::ClientBuilder) -> Result {