pub struct Config { /* private fields */ }Available on crate feature
cors only.Expand description
A configuration for CorsMiddleware.
Implementations§
Source§impl Config
impl Config
Sourcepub const fn max_age(self, max_age: usize) -> Config
pub const fn max_age(self, max_age: usize) -> Config
Seconds a preflight request can be cached. MDN
Sourcepub const fn credentials(self, credentials: bool) -> Config
pub const fn credentials(self, credentials: bool) -> Config
Whether to allow credentials. MDN
Sourcepub fn allow_methods<H>(self, allow_methods: H) -> Config
pub fn allow_methods<H>(self, allow_methods: H) -> Config
Allowed HTTP methods. MDN
Sourcepub fn allow_headers<H>(self, allow_headers: H) -> Config
pub fn allow_headers<H>(self, allow_headers: H) -> Config
Allowed HTTP headers. MDN
Sourcepub fn allow_origins<H>(self, allow_origins: H) -> Config
pub fn allow_origins<H>(self, allow_origins: H) -> Config
Allowed origins. MDN
Sourcepub fn expose_headers<H>(self, expose_headers: H) -> Config
pub fn expose_headers<H>(self, expose_headers: H) -> Config
Exposed HTTP headers. MDN
Sourcepub fn origin_verify(
self,
origin_verify: Option<Arc<dyn Fn(&HeaderValue) -> bool + Send + Sync>>,
) -> Config
pub fn origin_verify( self, origin_verify: Option<Arc<dyn Fn(&HeaderValue) -> bool + Send + Sync>>, ) -> Config
A function to verify the origin. If the function returns false, the request will be rejected.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl !RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
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