pub struct Cors { /* fields omitted */ }
A wrapping filter constructed via warp::cors()
.
Sets whether to add the Access-Control-Allow-Credentials
header.
Adds a method to the existing list of allowed request methods.
Panics if the provided argument is not a valid http::Method
.
Adds multiple methods to the existing list of allowed request methods.
Panics if the provided argument is not a valid http::Method
.
Adds a header to the list of allowed request headers.
Panics if the provided argument is not a valid http::header::HeaderName
.
Adds multiple headers to the list of allowed request headers.
Panics if any of the headers are not a valid http::header::HeaderName
.
Sets that any Origin
header is allowed.
This can allow websites you didn't instead 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 if the provided argument is not a valid Origin
.
Add multiple origins to the existing list of allowed Origin
s.
Panics if the provided argument is not a valid Origin
.
Sets the Access-Control-Max-Age
header.
use std::time::Duration;
use warp::Filter;
let cors = warp::cors()
.max_age(30)
.max_age(Duration::from_secs(30));
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static