Struct kvarn::cors::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>) -> Self

Allows CORS request from allowed_origin. Note that the scheme (https / http) is sensitive. Use Self::add_origin_uri for a Uri input.