mirror of https://github.com/fafhrd91/actix-web
print response body in read_response panic messages (#2055)
This commit is contained in:
parent
5b4105e1e6
commit
f1a59abea7
|
@ -162,7 +162,7 @@ where
|
||||||
let mut resp = app
|
let mut resp = app
|
||||||
.call(req)
|
.call(req)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|_| panic!("read_response failed at application call"));
|
.unwrap_or_else(|e| panic!("read_response failed at application call: {}", e));
|
||||||
|
|
||||||
let mut body = resp.take_body();
|
let mut body = resp.take_body();
|
||||||
let mut bytes = BytesMut::new();
|
let mut bytes = BytesMut::new();
|
||||||
|
@ -255,7 +255,7 @@ where
|
||||||
let body = read_body(res).await;
|
let body = read_body(res).await;
|
||||||
|
|
||||||
serde_json::from_slice(&body)
|
serde_json::from_slice(&body)
|
||||||
.unwrap_or_else(|e| panic!("read_response_json failed during deserialization: {}", e))
|
.unwrap_or_else(|e| panic!("read_response_json failed during deserialization of body: {:?}, {}", body, e))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn load_stream<S>(mut stream: S) -> Result<Bytes, Error>
|
pub async fn load_stream<S>(mut stream: S) -> Result<Bytes, Error>
|
||||||
|
@ -312,7 +312,7 @@ where
|
||||||
let body = read_response(app, req).await;
|
let body = read_response(app, req).await;
|
||||||
|
|
||||||
serde_json::from_slice(&body)
|
serde_json::from_slice(&body)
|
||||||
.unwrap_or_else(|_| panic!("read_response_json failed during deserialization"))
|
.unwrap_or_else(|_| panic!("read_response_json failed during deserialization of body: {:?}", body))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Test `Request` builder.
|
/// Test `Request` builder.
|
||||||
|
|
Loading…
Reference in New Issue