pub struct InnerHttpClient { /* private fields */ }Expand description
Internal implementation backing HttpClient.
The client is backed by a [reqwest::Client] which keeps connections alive and
can be cloned cheaply. The client also has a list of header fields to
extract from the response.
The client returns an HttpResponse. The client filters only the key value
for the give header_keys.
Implementations§
Source§impl InnerHttpClient
impl InnerHttpClient
Sourcepub async fn send_request(
&self,
method: Method,
url: String,
params: Option<&HashMap<String, Vec<String>>>,
headers: Option<HashMap<String, String>>,
body: Option<Vec<u8>>,
timeout_secs: Option<u64>,
) -> Result<HttpResponse, HttpClientError>
pub async fn send_request( &self, method: Method, url: String, params: Option<&HashMap<String, Vec<String>>>, headers: Option<HashMap<String, String>>, body: Option<Vec<u8>>, timeout_secs: Option<u64>, ) -> Result<HttpResponse, HttpClientError>
Sends an HTTP request and returns an HttpResponse.
§Errors
Returns an error if unable to send request or times out.
Sourcepub async fn send_request_with_query<Q: Serialize>(
&self,
method: Method,
url: String,
query: Option<&Q>,
headers: Option<HashMap<String, String>>,
body: Option<Vec<u8>>,
timeout_secs: Option<u64>,
) -> Result<HttpResponse, HttpClientError>
pub async fn send_request_with_query<Q: Serialize>( &self, method: Method, url: String, query: Option<&Q>, headers: Option<HashMap<String, String>>, body: Option<Vec<u8>>, timeout_secs: Option<u64>, ) -> Result<HttpResponse, HttpClientError>
Sends an HTTP request with query parameters using reqwest’s .query() method.
This method accepts any type implementing Serialize for query parameters,
avoiding HashMap conversion overhead.
§Errors
Returns an error if unable to send request or times out.
Sourcepub async fn to_response(
&self,
response: Response,
) -> Result<HttpResponse, HttpClientError>
pub async fn to_response( &self, response: Response, ) -> Result<HttpResponse, HttpClientError>
Converts a reqwest::Response into an HttpResponse.
Uses pre-interned HeaderName values to avoid string-to-header parsing per response.
§Errors
Returns an error if unable to send request or times out.
Trait Implementations§
Source§impl Clone for InnerHttpClient
impl Clone for InnerHttpClient
Source§fn clone(&self) -> InnerHttpClient
fn clone(&self) -> InnerHttpClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InnerHttpClient
impl Debug for InnerHttpClient
Source§impl Default for InnerHttpClient
impl Default for InnerHttpClient
Source§fn default() -> Self
fn default() -> Self
Creates a new default InnerHttpClient instance.
The default client is initialized with an empty list of header keys and a new reqwest::Client.