pub struct Cors<S> { /* private fields */ }
Expand description
Middleware which adds headers for CORS.
See the module docs for an example.
Implementations§
source§impl<S> Cors<S>
impl<S> Cors<S>
sourcepub fn new(inner: S) -> Self
pub fn new(inner: S) -> Self
Create a new Cors
.
See CorsLayer::new
for more details.
sourcepub fn permissive(inner: S) -> Self
pub fn permissive(inner: S) -> Self
A permissive configuration.
See CorsLayer::permissive
for more details.
sourcepub fn very_permissive(inner: S) -> Self
pub fn very_permissive(inner: S) -> Self
A very permissive configuration.
See CorsLayer::very_permissive
for more details.
sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
sourcepub fn allow_credentials<T>(self, allow_credentials: T) -> Selfwhere
T: Into<AllowCredentials>,
pub fn allow_credentials<T>(self, allow_credentials: T) -> Selfwhere
T: Into<AllowCredentials>,
Set the Access-Control-Allow-Credentials
header.
See CorsLayer::allow_credentials
for more details.
sourcepub fn allow_headers<T>(self, headers: T) -> Selfwhere
T: Into<AllowHeaders>,
pub fn allow_headers<T>(self, headers: T) -> Selfwhere
T: Into<AllowHeaders>,
Set the value of the Access-Control-Allow-Headers
header.
See CorsLayer::allow_headers
for more details.
sourcepub fn max_age<T>(self, max_age: T) -> Self
pub fn max_age<T>(self, max_age: T) -> Self
Set the value of the Access-Control-Max-Age
header.
See CorsLayer::max_age
for more details.
sourcepub fn allow_methods<T>(self, methods: T) -> Selfwhere
T: Into<AllowMethods>,
pub fn allow_methods<T>(self, methods: T) -> Selfwhere
T: Into<AllowMethods>,
Set the value of the Access-Control-Allow-Methods
header.
See CorsLayer::allow_methods
for more details.
sourcepub fn allow_origin<T>(self, origin: T) -> Selfwhere
T: Into<AllowOrigin>,
pub fn allow_origin<T>(self, origin: T) -> Selfwhere
T: Into<AllowOrigin>,
Set the value of the Access-Control-Allow-Origin
header.
See CorsLayer::allow_origin
for more details.
sourcepub fn expose_headers<T>(self, headers: T) -> Selfwhere
T: Into<ExposeHeaders>,
pub fn expose_headers<T>(self, headers: T) -> Selfwhere
T: Into<ExposeHeaders>,
Set the value of the Access-Control-Expose-Headers
header.
See CorsLayer::expose_headers
for more details.
sourcepub fn allow_private_network<T>(self, allow_private_network: T) -> Selfwhere
T: Into<AllowPrivateNetwork>,
pub fn allow_private_network<T>(self, allow_private_network: T) -> Selfwhere
T: Into<AllowPrivateNetwork>,
Set the value of the Access-Control-Allow-Private-Network
header.
See CorsLayer::allow_private_network
for more details.
Trait Implementations§
source§impl<S, ReqBody, ResBody> Service<Request<ReqBody>> for Cors<S>
impl<S, ReqBody, ResBody> Service<Request<ReqBody>> for Cors<S>
Auto Trait Implementations§
impl<S> !Freeze for Cors<S>
impl<S> !RefUnwindSafe for Cors<S>
impl<S> Send for Cors<S>where
S: Send,
impl<S> Sync for Cors<S>where
S: Sync,
impl<S> Unpin for Cors<S>where
S: Unpin,
impl<S> !UnwindSafe for Cors<S>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)