Use type alias
This commit is contained in:
parent
ea13dfab0e
commit
f4b30501df
|
@ -714,7 +714,7 @@ pub struct CorsOptions {
|
||||||
///
|
///
|
||||||
/// Defaults to `All`.
|
/// Defaults to `All`.
|
||||||
#[cfg_attr(feature = "serialization", serde(default))]
|
#[cfg_attr(feature = "serialization", serde(default))]
|
||||||
pub allowed_headers: AllOrSome<HashSet<HeaderFieldName>>,
|
pub allowed_headers: AllowedHeaders,
|
||||||
/// Allows users to make authenticated requests.
|
/// Allows users to make authenticated requests.
|
||||||
/// If true, injects the `Access-Control-Allow-Credentials` header in responses.
|
/// If true, injects the `Access-Control-Allow-Credentials` header in responses.
|
||||||
/// This allows cookies and credentials to be submitted across domains.
|
/// This allows cookies and credentials to be submitted across domains.
|
||||||
|
@ -1314,7 +1314,7 @@ fn validate(options: &Cors, request: &Request<'_>) -> Result<ValidationResult, E
|
||||||
/// Useful for pre-flight and during requests
|
/// Useful for pre-flight and during requests
|
||||||
fn validate_origin(
|
fn validate_origin(
|
||||||
origin: &Origin,
|
origin: &Origin,
|
||||||
allowed_origins: &AllOrSome<HashSet<Url>>,
|
allowed_origins: &AllowedOrigins,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
match *allowed_origins {
|
match *allowed_origins {
|
||||||
// Always matching is acceptable since the list of origins can be unbounded.
|
// Always matching is acceptable since the list of origins can be unbounded.
|
||||||
|
@ -1329,7 +1329,7 @@ fn validate_origin(
|
||||||
/// Validate allowed methods
|
/// Validate allowed methods
|
||||||
fn validate_allowed_method(
|
fn validate_allowed_method(
|
||||||
method: &AccessControlRequestMethod,
|
method: &AccessControlRequestMethod,
|
||||||
allowed_methods: &HashSet<Method>,
|
allowed_methods: &AllowedMethods,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let &AccessControlRequestMethod(ref request_method) = method;
|
let &AccessControlRequestMethod(ref request_method) = method;
|
||||||
if !allowed_methods.iter().any(|m| m == request_method) {
|
if !allowed_methods.iter().any(|m| m == request_method) {
|
||||||
|
@ -1343,7 +1343,7 @@ fn validate_allowed_method(
|
||||||
/// Validate allowed headers
|
/// Validate allowed headers
|
||||||
fn validate_allowed_headers(
|
fn validate_allowed_headers(
|
||||||
headers: &AccessControlRequestHeaders,
|
headers: &AccessControlRequestHeaders,
|
||||||
allowed_headers: &AllOrSome<HashSet<HeaderFieldName>>,
|
allowed_headers: &AllowedHeaders,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let &AccessControlRequestHeaders(ref headers) = headers;
|
let &AccessControlRequestHeaders(ref headers) = headers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue