From f4b30501df3efc11c2cdfe1a4a8a6afe8bc84f4a Mon Sep 17 00:00:00 2001 From: Yong Wen Chua Date: Wed, 19 Dec 2018 09:29:06 +0800 Subject: [PATCH] Use type alias --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d391816..8bc9935 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -714,7 +714,7 @@ pub struct CorsOptions { /// /// Defaults to `All`. #[cfg_attr(feature = "serialization", serde(default))] - pub allowed_headers: AllOrSome>, + pub allowed_headers: AllowedHeaders, /// Allows users to make authenticated requests. /// If true, injects the `Access-Control-Allow-Credentials` header in responses. /// This allows cookies and credentials to be submitted across domains. @@ -1314,7 +1314,7 @@ fn validate(options: &Cors, request: &Request<'_>) -> Result>, + allowed_origins: &AllowedOrigins, ) -> Result<(), Error> { match *allowed_origins { // Always matching is acceptable since the list of origins can be unbounded. @@ -1329,7 +1329,7 @@ fn validate_origin( /// Validate allowed methods fn validate_allowed_method( method: &AccessControlRequestMethod, - allowed_methods: &HashSet, + allowed_methods: &AllowedMethods, ) -> Result<(), Error> { let &AccessControlRequestMethod(ref request_method) = method; if !allowed_methods.iter().any(|m| m == request_method) { @@ -1343,7 +1343,7 @@ fn validate_allowed_method( /// Validate allowed headers fn validate_allowed_headers( headers: &AccessControlRequestHeaders, - allowed_headers: &AllOrSome>, + allowed_headers: &AllowedHeaders, ) -> Result<(), Error> { let &AccessControlRequestHeaders(ref headers) = headers;