1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-30 18:34:36 +01: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")