MockRequest

Struct MockRequest 

Source
pub struct MockRequest { /* private fields */ }

Implementations§

Source§

impl MockRequest

Source

pub fn new(method: Method, path: &str) -> MockRequest

Source

pub fn with_method(&mut self, method: Method) -> &mut MockRequest

Source

pub fn with_path(&mut self, path: &str) -> &mut MockRequest

Source

pub fn with_query(&mut self, string: &str) -> &mut MockRequest

Source

pub fn with_body(&mut self, bytes: &[u8]) -> &mut MockRequest

Source

pub fn header<K>(&mut self, name: K, value: &str) -> &mut MockRequest
where K: IntoHeaderName,

Trait Implementations§

Source§

impl RequestExt for MockRequest

Source§

fn http_version(&self) -> Version

The version of HTTP being used
Source§

fn method(&self) -> &Method

The request method, such as GET, POST, PUT, DELETE or PATCH
Source§

fn scheme(&self) -> Scheme

The scheme part of the request URL
Source§

fn host(&self) -> Host<'_>

The host part of the requested URL
Source§

fn virtual_root(&self) -> Option<&str>

The initial part of the request URL’s path that corresponds to a virtual root. This allows an application to have a virtual location that consumes part of the path.
Source§

fn path(&self) -> &str

The remainder of the path.
Source§

fn path_mut(&mut self) -> &mut String

Obtain the request path for mutation/rewrite
Source§

fn query_string(&self) -> Option<&str>

The portion of the request URL that follows the “?”
Source§

fn remote_addr(&self) -> SocketAddr

The remote IP address of the client or the last proxy that sent the request.
Source§

fn content_length(&self) -> Option<u64>

The byte-size of the body, if any
Source§

fn headers(&self) -> &HeaderMap

The request’s headers, as conduit::Headers.
Source§

fn body(&mut self) -> &mut dyn Read

A Reader for the body of the request Read more
Source§

fn extensions(&self) -> &Extensions

A readable map of extensions
Source§

fn mut_extensions(&mut self) -> &mut Extensions

A mutable map of extensions
Source§

fn elapsed(&self) -> Duration

The elapsed time since the start of the request (headers received) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.