1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-21 07:36:43 +00:00

add error response test for cors

This commit is contained in:
Nikolay Kim 2019-03-23 22:03:40 -07:00
parent 548f6f89bf
commit bc01d39d4d

View file

@ -871,6 +871,8 @@ mod tests {
assert!(cors.inner.validate_allowed_method(&req).is_err()); assert!(cors.inner.validate_allowed_method(&req).is_err());
assert!(cors.inner.validate_allowed_headers(&req).is_err()); assert!(cors.inner.validate_allowed_headers(&req).is_err());
let resp = test::call_success(&mut cors, req);
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
let req = TestRequest::with_header("Origin", "https://www.example.com") let req = TestRequest::with_header("Origin", "https://www.example.com")
.header(header::ACCESS_CONTROL_REQUEST_METHOD, "put") .header(header::ACCESS_CONTROL_REQUEST_METHOD, "put")