pub struct Cors { /* private fields */ }Expand description
It defines CORS instance.
Implementations§
Source§impl Cors
impl Cors
Sourcepub fn allow_methods<I>(self, methods: I) -> Result<Self, Error>
pub fn allow_methods<I>(self, methods: I) -> Result<Self, Error>
Adds multiple methods to the existing list of allowed request methods.
Sourcepub fn allow_any_origin(self) -> Self
pub fn allow_any_origin(self) -> Self
Sets that any Origin header is allowed.
§Warning
This can allow websites you didn’t intend to access this resource, it is usually better to set an explicit list.
Sourcepub fn allow_origins<I>(self, origins: I) -> Result<Self, Error>
pub fn allow_origins<I>(self, origins: I) -> Result<Self, Error>
Add multiple origins to the existing list of allowed Origins.
Sourcepub fn allow_headers<I>(self, headers: I) -> Result<Self, Error>
pub fn allow_headers<I>(self, headers: I) -> Result<Self, Error>
Adds multiple headers to the list of allowed request headers.
Note: These should match the values the browser sends via Access-Control-Request-Headers, e.g.content-type.
Sourcepub fn expose_headers<I>(self, headers: I) -> Result<Self, Error>
pub fn expose_headers<I>(self, headers: I) -> Result<Self, Error>
Adds multiple headers to the list of exposed request headers.
Note: These should match the values the browser sends via Access-Control-Request-Headers, e.g.content-type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cors
impl RefUnwindSafe for Cors
impl Send for Cors
impl Sync for Cors
impl Unpin for Cors
impl UnsafeUnpin for Cors
impl UnwindSafe for Cors
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