pub struct InnerHttpClient { /* private fields */ }
Expand description
A high-performance HttpClient
for HTTP requests.
The client is backed by a hyper 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: 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: HashMap<String, String>, body: Option<Vec<u8>>, timeout_secs: Option<u64>, ) -> Result<HttpResponse, HttpClientError>
Sends an HTTP request with the specified method, URL, headers, and body.
method
: The HTTP method to use (e.g., GET, POST).url
: The URL to send the request to.headers
: A map of header key-value pairs to include in the request.body
: An optional body for the request, represented as a byte vector.timeout_secs
: An optional timeout for the request in seconds.
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
.
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 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