kvarn::cors

Struct AllowList

source
pub struct AllowList { /* private fields */ }
Expand description

A CORS allow list which allowes hosts, methods, and headers from a associated path. This is a builder-like struct. Use the add_* methods to add allowed origins, methods, and headers. Multiple allow lists can be added to a Cors instance. See the example at Cors.

Use RuleSet::add to add a rule.

Implementations§

source§

impl AllowList

source

pub fn new(cache_for: Duration) -> Self

Creates a empty CORS allow list with the client cache duration of cache_for.

source

pub fn add_origin(self, allowed_origin: impl AsRef<str&g