From 56f12dc982091972fbfb21dbf4c6fbf7574396ed Mon Sep 17 00:00:00 2001 From: vpl Date: Mon, 23 Sep 2019 07:44:44 +0200 Subject: [PATCH] Use Access-Control-Allow-Method --- src/util.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util.rs b/src/util.rs index a3548fcb..741f06a8 100644 --- a/src/util.rs +++ b/src/util.rs @@ -47,7 +47,7 @@ impl CORS { impl Fairing for CORS { fn info(&self) -> Info { Info { - name: "Add CORS headers to requests", + name: "CORS", kind: Kind::Response } } @@ -60,12 +60,12 @@ impl Fairing for CORS { let req_allow_headers = CORS::get_header(&req_headers, "Access-Control-Request-Headers"); - let req_allow_methods =CORS::get_header(&req_headers,"Access-Control-Request-Methods"); + let req_allow_method = CORS::get_header(&req_headers,"Access-Control-Request-Method"); if request.method() == Method::Options || response.content_type() == Some(ContentType::JSON) { // Requests with credentials need explicit values since they do not allow wildcards. response.set_header(Header::new("Access-Control-Allow-Origin", req_allow_origin)); - response.set_header(Header::new("Access-Control-Allow-Methods", req_allow_methods)); + response.set_header(Header::new("Access-Control-Allow-Methods", req_allow_method)); response.set_header(Header::new("Access-Control-Allow-Headers", req_allow_headers)); response.set_header(Header::new("Access-Control-Allow-Credentials", "true")); }