Struct awc::ClientBuilder[][src]

pub struct ClientBuilder<S = (), M = ()> { /* fields omitted */ }

An HTTP Client builder

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

Implementations

impl ClientBuilder[src]

pub fn new(
) -> ClientBuilder<impl Service<TcpConnect<Uri>, Response = TcpConnection<Uri, TcpStream>, Error = TcpConnectError> + Clone, ()>
[src]

impl<S, Io, M> ClientBuilder<S, M> where
    S: Service<TcpConnect<Uri>, Response = TcpConnection<Uri, Io>, Error = TcpConnectError> + Clone + 'static,
    Io: ActixStream + Debug + 'static, 
[src]

pub fn connector<S1, Io1>(
    self,
    connector: Connector<S1>
) -> ClientBuilder<S1, M> where
    S1: Service<TcpConnect<Uri>, Response = TcpConnection<Uri, Io1>, Error = TcpConnectError> + Clone + 'static,
    Io1: ActixStream + Debug + 'static, 
[src]

Use custom connector service.

pub fn timeout(self, timeout: Duration) -> Self[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) -> Self[src]

Disable request timeout.

pub fn local_address(self, addr: IpAddr) -> Self[src]

Set local IP Address the connector would use for establishing connection.

pub fn max_http_version(self, val: Version) -> Self[src]

Maximum supported HTTP major version.

Supported versions are HTTP/1.1 and HTTP/2.

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

Do not follow redirects.

Redirects are allowed by default.

pub fn max_redirects(self, num: u8) -> Self[src]

Set max number of redirects.

Max redirects is set to 10 by default.

pub fn initial_window_size(self, size: u32) -> Self[src]

Indicates the initial window size (in octets) for HTTP2 stream-level flow control for received data.

The default value is 65,535 and is good for APIs, but not for big objects.

pub fn initial_connection_window_size(self, size: u32) -> Self[src]

Indicates the initial window size (in octets) for HTTP2 connection-level flow control for received data.

The default value is 65,535 and is good for APIs, but not for big objects.

pub fn no_default_headers(self) -> Self[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) -> Self where
    HeaderName: TryFrom<K>,
    <HeaderName as TryFrom<K>>::Error: Debug + Into<HttpError>,
    V: IntoHeaderValue,
    V::Error: Debug
[src]

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

pub fn basic_auth<N>(self, username: N, password: Option<&str>) -> Self where
    N: Display
[src]

Set client wide HTTP basic authorization header

pub fn bearer_auth<T>(self, token: T) -> Self where
    T: Display
[src]

Set client wide HTTP bearer authentication header

pub fn wrap<S1, M1>(
    self,
    mw: M1
) -> ClientBuilder<S, NestTransform<M, M1, S1, ConnectRequest>> where
    M: Transform<S1, ConnectRequest>,
    M1: Transform<M::Transform, ConnectRequest>, 
[src]

Registers middleware, in the form of a middleware component (type), that runs during inbound and/or outbound processing in the request life-cycle (request -> response), modifying request/response as necessary, across all requests managed by the Client.

pub fn finish(self) -> Client where
    M: Transform<DefaultConnector<ConnectorService<S, Io>>, ConnectRequest> + 'static,
    M::Transform: Service<ConnectRequest, Response = ConnectResponse, Error = SendRequestError>, 
[src]

Finish build process and create Client instance.

Auto Trait Implementations

impl<S = (), M = ()> !RefUnwindSafe for ClientBuilder<S, M>

impl<S, M> Send for ClientBuilder<S, M> where
    M: Send,
    S: Send

impl<S, M> Sync for ClientBuilder<S, M> where
    M: Sync,
    S: Sync

impl<S, M> Unpin for ClientBuilder<S, M> where
    M: Unpin,
    S: Unpin

impl<S = (), M = ()> !UnwindSafe for ClientBuilder<S, M>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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>,