Struct worker_plus::Cors
source · pub struct Cors { /* private fields */ }
Expand description
Cors struct, holding cors configuration
Implementations§
source§impl Cors
impl Cors
sourcepub fn with_credentials(self, credentials: bool) -> Self
pub fn with_credentials(self, credentials: bool) -> Self
Configures whether cors is allowed to share credentials or not.
sourcepub fn with_max_age(self, max_age: u32) -> Self
pub fn with_max_age(self, max_age: u32) -> Self
Configures how long cors is allowed to cache a preflight-response.
sourcepub fn with_origins<S: Into<String>, V: IntoIterator<Item = S>>(
self,
origins: V
) -> Self
pub fn with_origins<S: Into<String>, V: IntoIterator<Item = S>>(
self,
origins: V
) -> Self
Configures which origins are allowed for cors.
sourcepub fn with_methods<V: IntoIterator<Item = Method>>(self, methods: V) -> Self
pub fn with_methods<V: IntoIterator<Item = Method>>(self, methods: V) -> Self
Configures which methods are allowed for cors.
sourcepub fn with_allowed_headers<S: Into<String>, V: IntoIterator<Item = S>>(
self,
origins: V
) -> Self
pub fn with_allowed_headers<S: Into<String>, V: IntoIterator<Item = S>>(
self,
origins: V
) -> Self
Configures which headers are allowed for cors.
sourcepub fn with_exposed_headers<S: Into<String>, V: IntoIterator<Item = S>>(
self,
origins: V
) -> Self
pub fn with_exposed_headers<S: Into<String>, V: IntoIterator<Item = S>>(
self,
origins: V
) -> Self
Configures which headers the client is allowed to access.
sourcepub fn apply_headers(&self, headers: &mut Headers) -> Result<()>
pub fn apply_headers(&self, headers: &mut Headers) -> Result<()>
Applies the cors configuration to response headers.