test util body errors only require Debug

This commit is contained in:
Rob Ede 2021-12-14 22:26:52 +00:00
parent 84d7320f42
commit b168fcd606
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
1 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
//! Various helpers for Actix applications to use during testing. //! Various helpers for Actix applications to use during testing.
use std::{borrow::Cow, net::SocketAddr, rc::Rc}; use std::{borrow::Cow, fmt, net::SocketAddr, rc::Rc};
pub use actix_http::test::TestBuffer; pub use actix_http::test::TestBuffer;
use actix_http::{ use actix_http::{
@ -157,12 +157,12 @@ pub async fn read_response<S, B>(app: &S, req: Request) -> Bytes
where where
S: Service<Request, Response = ServiceResponse<B>, Error = Error>, S: Service<Request, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody + Unpin, B: MessageBody + Unpin,
B::Error: Into<Error>, B::Error: fmt::Debug,
{ {
let resp = app let resp = app
.call(req) .call(req)
.await .await
.unwrap_or_else(|e| panic!("read_response failed at application call: {}", e)); .unwrap_or_else(|e| panic!("read_response failed at application call: {:?}", e));
let body = resp.into_body(); let body = resp.into_body();
let mut bytes = BytesMut::new(); let mut bytes = BytesMut::new();
@ -204,7 +204,7 @@ where
pub async fn read_body<B>(res: ServiceResponse<B>) -> Bytes pub async fn read_body<B>(res: ServiceResponse<B>) -> Bytes
where where
B: MessageBody + Unpin, B: MessageBody + Unpin,
B::Error: Into<Error>, B::Error: fmt::Debug,
{ {
let body = res.into_body(); let body = res.into_body();
let mut bytes = BytesMut::new(); let mut bytes = BytesMut::new();
@ -257,7 +257,7 @@ where
pub async fn read_body_json<T, B>(res: ServiceResponse<B>) -> T pub async fn read_body_json<T, B>(res: ServiceResponse<B>) -> T
where where
B: MessageBody + Unpin, B: MessageBody + Unpin,
B::Error: Into<Error>, B::Error: fmt::Debug,
T: DeserializeOwned, T: DeserializeOwned,
{ {
let body = read_body(res).await; let body = read_body(res).await;
@ -308,7 +308,7 @@ pub async fn read_response_json<S, B, T>(app: &S, req: Request) -> T
where where
S: Service<Request, Response = ServiceResponse<B>, Error = Error>, S: Service<Request, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody + Unpin, B: MessageBody + Unpin,
B::Error: Into<Error>, B::Error: fmt::Debug,
T: DeserializeOwned, T: DeserializeOwned,
{ {
let body = read_response(app, req).await; let body = read_response(app, req).await;