pub struct CorsMiddleware { /* private fields */ }Expand description
Built-in CORS middleware.
Reads config from appsettings.json →Cors section at build time
and applies CORS headers to every response. Handles preflight OPTIONS.
Implementations§
Source§impl CorsMiddleware
impl CorsMiddleware
Sourcepub fn new(config: CorsConfig) -> CorsMiddleware
pub fn new(config: CorsConfig) -> CorsMiddleware
Create a new CORS middleware with the given configuration.
Trait Implementations§
Source§impl IMiddleware for CorsMiddleware
impl IMiddleware for CorsMiddleware
Source§fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<ControlFlow<()>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CorsMiddleware: 'async_trait,
fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<ControlFlow<()>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CorsMiddleware: 'async_trait,
Process an HTTP request (before hook). 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 UnsafeUnpin 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