Struct rweb::filters::cors::Builder [−][src]
pub struct Builder { /* fields omitted */ }
Expand description
A constructed via warp::cors()
.
Implementations
Sets whether to add the Access-Control-Allow-Credentials
header.
Adds a method to the existing list of allowed request methods.
Panics
Panics if the provided argument is not a valid http::Method
.
pub fn allow_methods<I>(self, methods: I) -> Builder where
I: IntoIterator,
Method: TryFrom<<I as IntoIterator>::Item>,
pub fn allow_methods<I>(self, methods: I) -> Builder where
I: IntoIterator,
Method: TryFrom<<I as IntoIterator>::Item>,
Adds multiple methods to the existing list of allowed request methods.
Panics
Panics if the provided argument is not a valid http::Method
.
Adds a header 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
.
Panics
Panics if the provided argument is not a valid http::header::HeaderName
.
pub fn allow_headers<I>(self, headers: I) -> Builder where
I: IntoIterator,
HeaderName: TryFrom<<I as IntoIterator>::Item>,
pub fn allow_headers<I>(self, headers: I) -> Builder where
I: IntoIterator,
HeaderName: TryFrom<<I as IntoIterator>::Item>,
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
.
Panics
Panics if any of the headers are not a valid http::header::HeaderName
.
Adds a header to the list of exposed headers.
Panics
Panics if the provided argument is not a valid http::header::HeaderName
.
pub fn expose_headers<I>(self, headers: I) -> Builder where
I: IntoIterator,
HeaderName: TryFrom<<I as IntoIterator>::Item>,
pub fn expose_headers<I>(self, headers: I) -> Builder where
I: IntoIterator,
HeaderName: TryFrom<<I as IntoIterator>::Item>,
Adds multiple headers to the list of exposed headers.
Panics
Panics if any of the headers are not a valid http::header::HeaderName
.
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.
Add an origin to the existing list of allowed Origin
s.
Panics
Panics if the provided argument is not a valid Origin
.
pub fn allow_origins<I>(self, origins: I) -> Builder where
I: IntoIterator,
<I as IntoIterator>::Item: IntoOrigin,
pub fn allow_origins<I>(self, origins: I) -> Builder where
I: IntoIterator,
<I as IntoIterator>::Item: IntoOrigin,
Add multiple origins to the existing list of allowed Origin
s.
Panics
Panics if the provided argument is not a valid Origin
.
Sets the Access-Control-Max-Age
header.
Example
use std::time::Duration; use warp::Filter; let cors = warp::cors() .max_age(30) // 30u32 seconds .max_age(Duration::from_secs(30)); // or a Duration
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl UnwindSafe for Builder
Blanket Implementations
Mutably borrows from an owned value. Read more
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V