pub struct MiddlewareTestHarness { /* private fields */ }
Expand description
Test harness for middleware testing
This provides a simple way to test middleware in isolation or as part of a pipeline
Implementations§
Source§impl MiddlewareTestHarness
impl MiddlewareTestHarness
Sourcepub fn add_middleware<M: Middleware + 'static>(self, middleware: M) -> Self
pub fn add_middleware<M: Middleware + 'static>(self, middleware: M) -> Self
Add middleware to the test pipeline
Sourcepub fn with_handler<F>(self, handler: F) -> Self
pub fn with_handler<F>(self, handler: F) -> Self
Set a custom test handler (default returns 200 OK)
Sourcepub async fn execute(&self, request: ElifRequest) -> MiddlewareTestResult
pub async fn execute(&self, request: ElifRequest) -> MiddlewareTestResult
Execute a test request through the middleware pipeline
Sourcepub fn stats(&self) -> ExecutionStats
pub fn stats(&self) -> ExecutionStats
Get execution statistics
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset execution statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MiddlewareTestHarness
impl !RefUnwindSafe for MiddlewareTestHarness
impl Send for MiddlewareTestHarness
impl Sync for MiddlewareTestHarness
impl Unpin for MiddlewareTestHarness
impl !UnwindSafe for MiddlewareTestHarness
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