pub struct RuntimeCorsConfig { /* private fields */ }Expand description
Runtime CORS middleware configuration.
Implementations§
Source§impl RuntimeCorsConfig
impl RuntimeCorsConfig
Sourcepub fn new<P, X, M>(policy: P, exempt_path: X, map_error: M) -> Selfwhere
P: Fn(&ServiceRequest) -> Result<RuntimeCorsPolicy, Error> + 'static,
X: Fn(&str) -> bool + 'static,
M: Fn(CorsMiddlewareError) -> Error + 'static,
pub fn new<P, X, M>(policy: P, exempt_path: X, map_error: M) -> Selfwhere
P: Fn(&ServiceRequest) -> Result<RuntimeCorsPolicy, Error> + 'static,
X: Fn(&str) -> bool + 'static,
M: Fn(CorsMiddlewareError) -> Error + 'static,
Builds a configuration from product-provided callbacks.
Sourcepub fn allowed_methods(
self,
methods: impl IntoIterator<Item = &'static str>,
) -> Self
pub fn allowed_methods( self, methods: impl IntoIterator<Item = &'static str>, ) -> Self
Sets preflight-allowed methods.
Sourcepub fn allowed_headers(
self,
headers: impl IntoIterator<Item = &'static str>,
) -> Self
pub fn allowed_headers( self, headers: impl IntoIterator<Item = &'static str>, ) -> Self
Sets preflight-allowed request headers.
Sourcepub fn exposed_headers(
self,
headers: impl IntoIterator<Item = &'static str>,
) -> Self
pub fn exposed_headers( self, headers: impl IntoIterator<Item = &'static str>, ) -> Self
Sets response headers exposed to browser JavaScript.
Sourcepub fn additional_origin_schemes(
self,
schemes: impl IntoIterator<Item = &'static str>,
) -> Self
pub fn additional_origin_schemes( self, schemes: impl IntoIterator<Item = &'static str>, ) -> Self
Accepts selected non-HTTP schemes while parsing request origins.
This does not authorize a scheme by itself. The normalized full origin must still match
RuntimeCorsPolicy::allowed_origins.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuntimeCorsConfig
impl !RefUnwindSafe for RuntimeCorsConfig
impl !Send for RuntimeCorsConfig
impl !Sync for RuntimeCorsConfig
impl Unpin for RuntimeCorsConfig
impl UnsafeUnpin for RuntimeCorsConfig
impl !UnwindSafe for RuntimeCorsConfig
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