Struct poem::middleware::Cors
source · [−]pub struct Cors { /* private fields */ }
Expand description
Implementations
sourceimpl Cors
impl Cors
sourcepub fn allow_credentials(self, allow_credentials: bool) -> Self
pub fn allow_credentials(self, allow_credentials: bool) -> Self
Set allow credentials.
sourcepub fn allow_header<T>(self, header: T) -> Self where
HeaderName: TryFrom<T>,
pub fn allow_header<T>(self, header: T) -> Self where
HeaderName: TryFrom<T>,
Add an allow header.
NOTE: Default is allow any header.
sourcepub fn allow_headers<I, T>(self, headers: I) -> Self where
I: IntoIterator<Item = T>,
HeaderName: TryFrom<T>,
pub fn allow_headers<I, T>(self, headers: I) -> Self where
I: IntoIterator<Item = T>,
HeaderName: TryFrom<T>,
Add many allow headers.
sourcepub fn allow_method<T>(self, method: T) -> Self where
Method: TryFrom<T>,
pub fn allow_method<T>(self, method: T) -> Self where
Method: TryFrom<T>,
Add an allow method.
NOTE: Default is allow any method.
sourcepub fn allow_methods<I, T>(self, methods: I) -> Self where
I: IntoIterator<Item = T>,
Method: TryFrom<T>,
pub fn allow_methods<I, T>(self, methods: I) -> Self where
I: IntoIterator<Item = T>,
Method: TryFrom<T>,
Add many allow methods.
sourcepub fn allow_origin<T>(self, origin: T) -> Self where
HeaderValue: TryFrom<T>,
pub fn allow_origin<T>(self, origin: T) -> Self where
HeaderValue: TryFrom<T>,
Add an allow origin.
NOTE: Default is allow any origin.
sourcepub fn allow_origins<I, T>(self, origins: I) -> Self where
I: IntoIterator<Item = T>,
HeaderValue: TryFrom<T>,
pub fn allow_origins<I, T>(self, origins: I) -> Self where
I: IntoIterator<Item = T>,
HeaderValue: TryFrom<T>,
Add many allow origins.
sourcepub fn allow_origins_fn<F>(self, f: F) -> Self where
F: Fn(&str) -> bool + Send + Sync + 'static,
pub fn allow_origins_fn<F>(self, f: F) -> Self where
F: Fn(&str) -> bool + Send + Sync + 'static,
Determinate allowed origins by processing requests which didn’t match
any origins specified in the allow_origin
.
This function will receive the Origin
header, which can be used to
determine whether to allow the request.
sourcepub fn expose_header<T>(self, header: T) -> Self where
HeaderName: TryFrom<T>,
pub fn expose_header<T>(self, header: T) -> Self where
HeaderName: TryFrom<T>,
Add an expose header.
sourcepub fn expose_headers<I, T>(self, headers: I) -> Self where
I: IntoIterator<Item = T>,
HeaderName: TryFrom<T>,
pub fn expose_headers<I, T>(self, headers: I) -> Self where
I: IntoIterator<Item = T>,
HeaderName: TryFrom<T>,
Add many expose headers.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Cors
impl Send for Cors
impl Sync for Cors
impl Unpin for Cors
impl !UnwindSafe for Cors
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more