diff --git a/src/middleware/cors.rs b/src/middleware/cors.rs index a2667430..f251d6b4 100644 --- a/src/middleware/cors.rs +++ b/src/middleware/cors.rs @@ -748,13 +748,18 @@ mod tests { #[test] fn test_validate_origin() { let cors = Cors::build() - .allowed_origin("http://www.example.com").finish().unwrap(); + .allowed_origin("https://www.example.com").finish().unwrap(); - let mut req = TestRequest::with_header( - "Origin", "https://www.unknown.com") + let mut req = TestRequest::with_header("Origin", "https://www.unknown.com") .method(Method::GET) .finish(); assert!(cors.start(&mut req).is_err()); + + let mut req = TestRequest::with_header("Origin", "https://www.example.com") + .method(Method::GET) + .finish(); + + assert!(cors.start(&mut req).unwrap().is_done()); } }