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) -> Self
pub const fn max_age(self, max_age: usize) -> Self
Seconds a preflight request can be cached. MDN
Sourcepub const fn credentials(self, credentials: bool) -> Self
pub const fn credentials(self, credentials: bool) -> Self
Whether to allow credentials. MDN
Sourcepub fn allow_methods<H>(self, allow_methods: H) -> Self
pub fn allow_methods<H>(self, allow_methods: H) -> Self
Allowed HTTP methods. MDN
Sourcepub fn allow_headers<H>(self, allow_headers: H) -> Self
pub fn allow_headers<H>(self, allow_headers: H) -> Self
Allowed HTTP headers. MDN
Sourcepub fn allow_origins<H>(self, allow_origins: H) -> Self
pub fn allow_origins<H>(self, allow_origins: H) -> Self
Allowed origins. MDN
Sourcepub fn expose_headers<H>(self, expose_headers: H) -> Self
pub fn expose_headers<H>(self, expose_headers: H) -> Self
Exposed HTTP headers. MDN
Sourcepub fn origin_verify(
self,
origin_verify: Option<Arc<dyn Fn(&HeaderValue) -> bool + Send + Sync>>,
) -> Self
pub fn origin_verify( self, origin_verify: Option<Arc<dyn Fn(&HeaderValue) -> bool + Send + Sync>>, ) -> Self
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