pub struct MockMiddleware { /* private fields */ }
Expand description
Mock middleware for testing
Implementations§
Source§impl MockMiddleware
impl MockMiddleware
Sourcepub fn returns_response<S: Into<String>>(name: S, status: u16, body: S) -> Self
pub fn returns_response<S: Into<String>>(name: S, status: u16, body: S) -> Self
Create a mock that returns a specific response
Sourcepub fn adds_header<S: Into<String>>(
name: S,
header_name: S,
header_value: S,
) -> Self
pub fn adds_header<S: Into<String>>( name: S, header_name: S, header_value: S, ) -> Self
Create a mock that adds a header
Sourcepub fn delays<S: Into<String>>(name: S, delay: Duration) -> Self
pub fn delays<S: Into<String>>(name: S, delay: Duration) -> Self
Create a mock that delays execution
Sourcepub fn execution_count(&self) -> u32
pub fn execution_count(&self) -> u32
Get the number of times this middleware has been executed
Sourcepub fn reset_count(&self)
pub fn reset_count(&self)
Reset execution count
Trait Implementations§
Source§impl Clone for MockMiddleware
impl Clone for MockMiddleware
Source§fn clone(&self) -> MockMiddleware
fn clone(&self) -> MockMiddleware
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MockMiddleware
impl Debug for MockMiddleware
Source§impl Middleware for MockMiddleware
impl Middleware for MockMiddleware
Source§fn handle(&self, request: ElifRequest, next: Next) -> NextFuture<'static>
fn handle(&self, request: ElifRequest, next: Next) -> NextFuture<'static>
Handle the request and call the next middleware in the chain
Auto Trait Implementations§
impl Freeze for MockMiddleware
impl RefUnwindSafe for MockMiddleware
impl Send for MockMiddleware
impl Sync for MockMiddleware
impl Unpin for MockMiddleware
impl UnwindSafe for MockMiddleware
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more