[−][src]Struct actix_web::client::ClientBuilder
An HTTP Client builder
This type can be used to construct an instance of Client
through a
builder-like pattern.
Methods
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,
[src]
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: HttpTryFrom<K>,
<HeaderName as HttpTryFrom<K>>::Error: Debug,
<V as IntoHeaderValue>::Error: Debug,
[src]
V: IntoHeaderValue,
HeaderName: HttpTryFrom<K>,
<HeaderName as HttpTryFrom<K>>::Error: Debug,
<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,
[src]
U: Display,
Set client wide HTTP basic authorization header
pub fn bearer_auth<T>(self, token: T) -> ClientBuilder where
T: Display,
[src]
T: Display,
Set client wide HTTP bearer authentication header
pub fn finish(self) -> Client
[src]
Finish build process and create Client
instance.
Auto Trait Implementations
impl !Send for ClientBuilder
impl Unpin for ClientBuilder
impl !Sync for ClientBuilder
impl !UnwindSafe for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,