Type Alias HttpClient

Source
pub type HttpClient = Client;
Expand description

A Client from the reqwest crate, that we use to download content over HTTP.

Aliased Type§

pub struct HttpClient { /* private fields */ }

Implementations

Source§

impl Client

Source

pub fn new() -> Client

Constructs a new Client.

§Panics

This method panics if a TLS backend cannot be initialized, or the resolver cannot load the system configuration.

Use Client::builder() if you wish to handle the failure as an Error instead of panicking.

Source

pub fn builder() -> ClientBuilder

Creates a ClientBuilder to configure a Client.

This is the same as ClientBuilder::new().

Source

pub fn get<U>(&self, url: U) -> RequestBuilder
where U: IntoUrl,

Convenience method to make a GET request to a URL.

§Errors

This method fails whenever the supplied Url cannot be parsed.

Source

pub fn post<U>(&self, url: U) -> RequestBuilder
where U: IntoUrl,

Convenience method to make a POST request to a URL.

§Errors

This method fails whenever the supplied Url cannot be parsed.

Source

pub fn put<U>(&self, url: U) -> RequestBuilder
where U: IntoUrl,

Convenience method to make a PUT request to a URL.

§Errors

This method fails whenever the supplied Url cannot be parsed.

Source

pub fn patch<U>(&self, url: U) -> RequestBuilder
where U: IntoUrl,

Convenience method to make a PATCH request to a URL.

§Errors

This method fails whenever the supplied Url cannot be parsed.

Source

pub fn delete<U>(&self, url: U) -> RequestBuilder
where U: IntoUrl,

Convenience method to make a DELETE request to a URL.

§Errors

This method fails whenever the supplied Url cannot be parsed.

Source

pub fn head<U>(&self, url: U) -> RequestBuilder
where U: IntoUrl,

Convenience method to make a HEAD request to a URL.

§Errors

This method fails whenever the supplied Url cannot be parsed.

Source

pub fn request<U>(&self, method: Method, url: U) -> RequestBuilder
where U: IntoUrl,

Start building a Request with the Method and Url.

Returns a RequestBuilder, which will allow setting headers and the request body before sending.

§Errors

This method fails whenever the supplied Url cannot be parsed.

Source

pub fn execute( &self, request: Request, ) -> impl Future<Output = Result<Response, Error>>

Executes a Request.

A Request can be built manually with Request::new() or obtained from a RequestBuilder with RequestBuilder::build().

You should prefer to use the RequestBuilder and RequestBuilder::send().

§Errors

This method fails if there was an error while sending request, redirect loop was detected or redirect limit was exhausted.

Trait Implementations

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Client

Source§

fn default() -> Client

Returns the “default value” for a type. Read more
Source§

impl Service<Request> for Client

Source§

type Response = Response

Responses given by the service.
Source§

type Error = Error

Errors produced by the service.
Source§

type Future = Pending

The future response value.
Source§

fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll<Result<(), <Client as Service<Request>>::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
Source§

fn call(&mut self, req: Request) -> <Client as Service<Request>>::Future

Process the request and return the response asynchronously. Read more