[−][src]Struct tide::security::CorsMiddleware
Middleware for CORS
Example
use http_types::headers::HeaderValue; use tide::security::{CorsMiddleware, Origin}; let cors = CorsMiddleware::new() .allow_methods("GET, POST, OPTIONS".parse::<HeaderValue>().unwrap()) .allow_origin(Origin::from("*")) .allow_credentials(false);
Implementations
impl CorsMiddleware
[src]
#[must_use]pub fn new() -> Self
[src]
Creates a new Cors middleware.
#[must_use]pub fn allow_credentials(self, allow_credentials: bool) -> Self
[src]
Set allow_credentials
and return new Cors
pub fn allow_headers<T: Into<HeaderValue>>(self, headers: T) -> Self
[src]
Set allow_headers
and return new Cors
pub fn max_age<T: Into<HeaderValue>>(self, max_age: T) -> Self
[src]
Set max_age
and return new Cors
pub fn allow_methods<T: Into<HeaderValue>>(self, methods: T) -> Self
[src]
Set allow_methods
and return new Cors
pub fn allow_origin<T: Into<Origin>>(self, origin: T) -> Self
[src]
Set allow_origin
and return new Cors
pub fn expose_headers<T: Into<HeaderValue>>(self, headers: T) -> Self
[src]
Set expose_headers
and return new Cors
Trait Implementations
impl Clone for CorsMiddleware
[src]
fn clone(&self) -> CorsMiddleware
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CorsMiddleware
[src]
impl Default for CorsMiddleware
[src]
impl Hash for CorsMiddleware
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<State: Send + Sync + 'static> Middleware<State> for CorsMiddleware
[src]
Auto Trait Implementations
impl RefUnwindSafe for CorsMiddleware
impl Send for CorsMiddleware
impl Sync for CorsMiddleware
impl Unpin for CorsMiddleware
impl UnwindSafe for CorsMiddleware
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,