From: horizon Date: Sun, 26 Feb 2023 23:28:33 +0000 (+0800) Subject: fix: cors allow-request-header add content-type (#184) X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=6dcb4dcd76252e4a36fbb1c8f7f52ae4a0da9de1;p=ozva-cloud fix: cors allow-request-header add content-type (#184) * fix: cors allow-request-header add content-type * add content-type test --- diff --git a/src/server.rs b/src/server.rs index 1b1dabd..feb2f3d 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1222,7 +1222,7 @@ fn add_cors(res: &mut Response) { ); res.headers_mut().insert( "Access-Control-Allow-Headers", - HeaderValue::from_static("Authorization,Destination,Range"), + HeaderValue::from_static("Authorization,Destination,Range,Content-Type"), ); res.headers_mut().insert( "Access-Control-Expose-Headers", diff --git a/tests/cors.rs b/tests/cors.rs index e325226..d6ed521 100644 --- a/tests/cors.rs +++ b/tests/cors.rs @@ -23,7 +23,7 @@ fn cors(#[with(&["--enable-cors"])] server: TestServer) -> Result<(), Error> { ); assert_eq!( resp.headers().get("access-control-allow-headers").unwrap(), - "Authorization,Destination,Range" + "Authorization,Destination,Range,Content-Type" ); assert_eq!( resp.headers().get("access-control-expose-headers").unwrap(),