From 3afb068713461e27e7631fb1037cd98b0906973d Mon Sep 17 00:00:00 2001 From: Uwe Grawert Date: Thu, 19 Jun 2025 17:04:41 +0200 Subject: [PATCH] Fix AsyncJsonRpcClient to reuse HttpClient --- src/asynch/clients/json_rpc/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/asynch/clients/json_rpc/mod.rs b/src/asynch/clients/json_rpc/mod.rs index be3d8b9b..02cbb8e4 100644 --- a/src/asynch/clients/json_rpc/mod.rs +++ b/src/asynch/clients/json_rpc/mod.rs @@ -45,11 +45,15 @@ mod _std { pub struct AsyncJsonRpcClient { url: Url, + client: HttpClient, } impl AsyncJsonRpcClient { pub fn connect(url: Url) -> Self { - Self { url } + Self { + url, + client: HttpClient::new(), + } } } @@ -58,9 +62,9 @@ mod _std { &self, request: XRPLRequest<'a>, ) -> XRPLClientResult> { - let client = HttpClient::new(); let request_json_rpc = request_to_json_rpc(&request)?; - let response = client + let response = self + .client .post(self.url.as_ref()) .json(&request_json_rpc) .send()