[][src]Struct actix_web::client::ClientBuilder

pub struct ClientBuilder { /* fields omitted */ }

An HTTP Client builder

This type can be used to construct an instance of Client through a builder-like pattern.


impl ClientBuilder[src]

pub fn new() -> ClientBuilder[src]

pub fn connector<T>(self, connector: T) -> ClientBuilder where
    T: Service<Request = Connect, Error = ConnectError> + 'static,
    <T as Service>::Response: Connection,
    <<T as Service>::Response as Connection>::Future: 'static,
    <T as Service>::Future: 'static, 

Use custom connector service.

pub fn timeout(self, timeout: Duration) -> ClientBuilder[src]

Set request timeout

Request timeout is the total time before a response must be received. Default value is 5 seconds.

pub fn disable_timeout(self) -> ClientBuilder[src]

Disable request timeout.

pub fn disable_redirects(self) -> ClientBuilder[src]

Do not follow redirects.

Redirects are allowed by default.

pub fn max_redirects(self, num: usize) -> ClientBuilder[src]

Set max number of redirects.

Max redirects is set to 10 by default.

pub fn no_default_headers(self) -> ClientBuilder[src]

Do not add default request headers. By default Date and User-Agent headers are set.

pub fn header<K, V>(self, key: K, value: V) -> ClientBuilder where
    V: IntoHeaderValue,
    HeaderName: TryFrom<K>,
    <HeaderName as TryFrom<K>>::Error: Debug,
    <HeaderName as TryFrom<K>>::Error: Into<Error>,
    <V as IntoHeaderValue>::Error: Debug

Add default header. Headers added by this method get added to every request.

pub fn basic_auth<U>(self, username: U, password: Option<&str>) -> ClientBuilder where
    U: Display

Set client wide HTTP basic authorization header

pub fn bearer_auth<T>(self, token: T) -> ClientBuilder where
    T: Display

Set client wide HTTP bearer authentication header

pub fn finish(self) -> Client[src]

Finish build process and create Client instance.

Trait Implementations

impl Default for ClientBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,