pub trait RequestExt<B>: Sized {
// Required methods
fn with_version(self, version: Version) -> Request<B>;
fn with_method(self, method: Method) -> Request<B>;
fn with_header<K>(self, key: K, value: HeaderValue) -> Request<B>
where K: IntoHeaderName;
fn with_headers(self, header_map: HeaderMap) -> Request<B>;
fn send<S, R>(
self,
client: S,
) -> impl Future<Output = Result<S::Response>> + Send
where B: Body<Data = Bytes> + Send + Sync + 'static,
B::Error: Into<BoxError>,
S: Service<Request<ClientBody>, Response = Response<R>> + Send + Sync,
R: Body + Send + Sync + 'static,
<S as Service<Request<ClientBody>>>::Error: Into<BoxError>,
<S as Service<Request<ClientBody>>>::Future: Send;
// Provided methods
fn with_basic_auth<U, P>(
self,
username: U,
password: Option<P>,
) -> Request<B>
where U: Display,
P: Display,
Self: Sized { ... }
fn with_bearer_auth<T>(self, token: T) -> Request<B>
where T: Display { ... }
}Expand description
Extension trait for http::Request.
Required Methods§
fn with_version(self, version: Version) -> Request<B>
fn with_method(self, method: Method) -> Request<B>
fn with_header<K>(self, key: K, value: HeaderValue) -> Request<B>where
K: IntoHeaderName,
fn with_headers(self, header_map: HeaderMap) -> Request<B>
fn send<S, R>( self, client: S, ) -> impl Future<Output = Result<S::Response>> + Send
Provided Methods§
fn with_basic_auth<U, P>(self, username: U, password: Option<P>) -> Request<B>
Available on crate feature
auth only.fn with_bearer_auth<T>(self, token: T) -> Request<B>where
T: Display,
Available on crate feature
auth only.Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<B> RequestExt<B> for Request<B>where
B: Send,
impl<B> RequestExt<B> for Request<B>where
B: Send,
Source§fn with_version(self, version: Version) -> Request<B>
fn with_version(self, version: Version) -> Request<B>
Set the request HTTP version.
Source§fn with_method(self, method: Method) -> Request<B>
fn with_method(self, method: Method) -> Request<B>
Set the request method.
Source§fn with_header<K>(self, key: K, value: HeaderValue) -> Request<B>where
K: IntoHeaderName,
fn with_header<K>(self, key: K, value: HeaderValue) -> Request<B>where
K: IntoHeaderName,
Set a request header.
Source§fn with_headers(self, header_map: HeaderMap) -> Request<B>
fn with_headers(self, header_map: HeaderMap) -> Request<B>
Extend multiple request headers.