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,
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, headers: Option<HashMap<String, String>>, body: Option<Vec<u8>>, timeout_secs: Option<u64>, ) -> Result<HttpResponse, HttpClientError>
Sends an HTTP request and returns an HttpResponse
.
method
: The HTTP method (e.g. GET, POST).url
: The target URL.headers
: Extra headers to send.body
: Optional request body.timeout_secs
: Optional request timeout in seconds.
§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
.
§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
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
.
Auto Trait Implementations§
impl Freeze for InnerHttpClient
impl !RefUnwindSafe for InnerHttpClient
impl Send for InnerHttpClient
impl Sync for InnerHttpClient
impl Unpin for InnerHttpClient
impl !UnwindSafe for InnerHttpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more