pub struct CorsMiddleware { /* private fields */ }Expand description
CORS middleware.
Handles preflight OPTIONS requests and adds CORS response headers.
Implementations§
Source§impl CorsMiddleware
impl CorsMiddleware
pub fn new(config: CorsConfig) -> CorsMiddleware
Trait Implementations§
Source§impl Middleware for CorsMiddleware
impl Middleware for CorsMiddleware
Source§fn before_request<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CorsMiddleware: 'async_trait,
fn before_request<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CorsMiddleware: 'async_trait,
Called before the request is dispatched to plugins. Read more
Source§fn after_request<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
response: AuthResponse,
) -> Pin<Box<dyn Future<Output = Result<AuthResponse, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CorsMiddleware: 'async_trait,
fn after_request<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
response: AuthResponse,
) -> Pin<Box<dyn Future<Output = Result<AuthResponse, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CorsMiddleware: 'async_trait,
Called after a response has been produced. Read more
Auto Trait Implementations§
impl Freeze for CorsMiddleware
impl RefUnwindSafe for CorsMiddleware
impl Send for CorsMiddleware
impl Sync for CorsMiddleware
impl Unpin for CorsMiddleware
impl UnwindSafe for CorsMiddleware
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