Struct awc::ClientBuilder [−][src]
Expand description
An HTTP Client builder
This type can be used to construct an instance of Client
through a
builder-like pattern.
Implementations
pub fn new(
) -> ClientBuilder<impl Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, TcpStream>, Error = TcpConnectError> + Clone, ()>
impl<S, Io, M> ClientBuilder<S, M> where
S: Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, Io>, Error = TcpConnectError> + Clone + 'static,
Io: ActixStream + Debug + 'static,
impl<S, Io, M> ClientBuilder<S, M> where
S: Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, Io>, Error = TcpConnectError> + Clone + 'static,
Io: ActixStream + Debug + 'static,
pub fn connector<S1, Io1>(
self,
connector: Connector<S1>
) -> ClientBuilder<S1, M> where
S1: Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, Io1>, Error = TcpConnectError> + Clone + 'static,
Io1: ActixStream + Debug + 'static,
pub fn connector<S1, Io1>(
self,
connector: Connector<S1>
) -> ClientBuilder<S1, M> where
S1: Service<ConnectInfo<Uri>, Response = TcpConnection<Uri, Io1>, Error = TcpConnectError> + Clone + 'static,
Io1: ActixStream + Debug + 'static,
Use custom connector service.
Set request timeout
Request timeout is the total time before a response must be received. Default value is 5 seconds.
Disable request timeout.
Set local IP Address the connector would use for establishing connection.
Maximum supported HTTP major version.
Supported versions are HTTP/1.1 and HTTP/2.
Do not follow redirects.
Redirects are allowed by default.
Set max number of redirects.
Max redirects is set to 10 by default.
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.
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.
Do not add fundamental default request headers.
By default Date
and User-Agent
headers are set.
Add default header.
Headers added by this method get added to every request unless overriden by .
Panics
Panics if header name or value is invalid.
Set client wide HTTP basic authorization header
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>,
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>,
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<ConnectorServicePriv<TcpConnectorService<TcpConnectorInnerService<S>>, Rc<dyn Service<Connect, Response = (Box<dyn ConnectionIo>, Protocol), Error = ConnectError, Future = LocalBoxFuture<'static, Result<(Box<dyn ConnectionIo>, Protocol), ConnectError>>>>, Io, Box<dyn ConnectionIo>>>, ConnectRequest> + 'static,
M::Transform: Service<ConnectRequest, Response = ConnectResponse, Error = SendRequestError>,
pub fn finish(self) -> Client where
M: Transform<DefaultConnector<ConnectorServicePriv<TcpConnectorService<TcpConnectorInnerService<S>>, Rc<dyn Service<Connect, Response = (Box<dyn ConnectionIo>, Protocol), Error = ConnectError, Future = LocalBoxFuture<'static, Result<(Box<dyn ConnectionIo>, Protocol), ConnectError>>>>, Io, Box<dyn ConnectionIo>>>, ConnectRequest> + 'static,
M::Transform: Service<ConnectRequest, Response = ConnectResponse, Error = SendRequestError>,
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
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more