Skip to main content

rivet_core/
middleware.rs

1use rivet_http::{Request, Response};
2
3/// Middleware contract for request/response interception around dispatch.
4pub trait Middleware: Send + Sync {
5    /// Handle one request and either call `next` or short-circuit with a response.
6    fn handle(&self, req: Request, next: &(dyn Fn(Request) -> Response + Send + Sync)) -> Response;
7}