Trait Request

Source
pub trait Request<B: HttpBody>: Send {
    // Required methods
    fn version(&self) -> Version;
    fn method(&self) -> &Method;
    fn uri(&self) -> &Uri;
    fn headers(&self) -> &HeaderMap;
    fn send(
        self,
        headers: Option<HeaderMap>,
    ) -> impl Future<Output = Result<Response<B>>> + Send;
}
Expand description

An abstraction of an HTTP request.

This trait is used in HTTP middleware integrations to abstract the request type and sending the request upstream.

Required Methods§

Source

fn version(&self) -> Version

Gets the request’s version.

Source

fn method(&self) -> &Method

Gets the request’s method.

Source

fn uri(&self) -> &Uri

Gets the request’s URI.

Source

fn headers(&self) -> &HeaderMap

Gets the request’s headers.

Source

fn send( self, headers: Option<HeaderMap>, ) -> impl Future<Output = Result<Response<B>>> + Send

Sends the request to upstream and gets the response.

If headers is Some, the supplied headers should override any matching headers in the original request.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§