mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
fix h2 not using error response (#1080)
* fix h2 not using error response * add fix change log * fix h2 service error tests
This commit is contained in:
parent
1d96ae9bc3
commit
5e8f1c338c
@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
* Add `middleware::Conditon` that conditionally enables another middleware
|
* Add `middleware::Conditon` that conditionally enables another middleware
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* h2 will use error response #1080
|
||||||
|
|
||||||
## [1.0.7] - 2019-08-29
|
## [1.0.7] - 2019-08-29
|
||||||
|
|
||||||
|
@ -257,8 +257,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(Async::NotReady) => Ok(Async::NotReady),
|
Ok(Async::NotReady) => Ok(Async::NotReady),
|
||||||
Err(_e) => {
|
Err(e) => {
|
||||||
let res: Response = Response::InternalServerError().finish();
|
let res: Response = e.into().into();
|
||||||
let (res, body) = res.replace_body(());
|
let (res, body) = res.replace_body(());
|
||||||
|
|
||||||
let mut send = send.take().unwrap();
|
let mut send = send.take().unwrap();
|
||||||
|
@ -454,9 +454,9 @@ fn test_h2_service_error() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let response = srv.block_on(srv.sget("/").send()).unwrap();
|
let response = srv.block_on(srv.sget("/").send()).unwrap();
|
||||||
assert_eq!(response.status(), http::StatusCode::INTERNAL_SERVER_ERROR);
|
assert_eq!(response.status(), http::StatusCode::BAD_REQUEST);
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.load_body(response).unwrap();
|
let bytes = srv.load_body(response).unwrap();
|
||||||
assert!(bytes.is_empty());
|
assert_eq!(bytes, Bytes::from_static(b"error"));
|
||||||
}
|
}
|
||||||
|
@ -449,11 +449,11 @@ fn test_h2_service_error() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let response = srv.block_on(srv.sget("/").send()).unwrap();
|
let response = srv.block_on(srv.sget("/").send()).unwrap();
|
||||||
assert_eq!(response.status(), StatusCode::INTERNAL_SERVER_ERROR);
|
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.load_body(response).unwrap();
|
let bytes = srv.load_body(response).unwrap();
|
||||||
assert!(bytes.is_empty());
|
assert_eq!(bytes, Bytes::from_static(b"error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user