pub struct Cors(/* private fields */);
Expand description
CORS configuration
Implementations§
Source§impl Cors
impl Cors
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new instance with Content-Type
as mandatory header and POST
as mandatory method.
Sourcepub fn with_origins(self, origins: Vec<String>) -> Self
pub fn with_origins(self, origins: Vec<String>) -> Self
Configure CORS to only allow specific origins. Note that multiple calls to this method will override any previous origin-related calls.
Sourcepub fn with_any_origin(self) -> Self
pub fn with_any_origin(self) -> Self
Configure CORS to allow every origin. Also known as the *
wildcard.
Note that multiple calls to this method will override any previous origin-related calls.
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 !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