Struct tower_http::cors::MaxAge
source · pub struct MaxAge(_);
Available on crate feature
cors
only.Expand description
Holds configuration for how to set the Access-Control-Max-Age
header.
See CorsLayer::max_age
for more details.
Implementations§
source§impl MaxAge
impl MaxAge
sourcepub fn exact(max_age: Duration) -> Self
pub fn exact(max_age: Duration) -> Self
Set a static max-age value
See CorsLayer::max_age
for more details.
sourcepub fn dynamic<F>(f: F) -> Selfwhere
F: Fn(&HeaderValue, &RequestParts) -> Duration + Send + Sync + 'static,
pub fn dynamic<F>(f: F) -> Selfwhere
F: Fn(&HeaderValue, &RequestParts) -> Duration + Send + Sync + 'static,
Set the max-age based on the preflight request parts
See CorsLayer::max_age
for more details.