pub async fn read_json<T: DeserializeOwned>(
    response: &mut Response<Body>,
) -> T {
    let headers = response.headers();
    assert_eq!(
        crate::CONTENT_TYPE_JSON,
        headers.get(http::header::CONTENT_TYPE).expect("missing content-type")
    );
    let body_bytes =
        to_bytes(response.body_mut()).await.expect("error reading body");
    serde_json::from_slice(body_bytes.as_ref())
        .expect("failed to parse server body as expected type")
}
/**
 * Given a Hyper response whose body is expected to be a JSON object that should
 * be parseable via Serde as type T, asynchronously read the body of the
 * response and parse it, returning an instance of T.
 */
Given a Hyper response whose body is expected to be a JSON object that should
be parseable via Serde as type T, asynchronously read the body of the
response and parse it, returning an instance of T.
Given a Hyper response whose body is expected to be a JSON object that should be parseable via Serde as type T asynchronously read the body of the response and parse it returning an instance of T .
pub async fn read_json<T: DeserializeOwned>(
    response: &mut Response<Body>,
) -> T {
    let headers = response.headers();
    assert_eq!(
        crate::CONTENT_TYPE_JSON,
        headers.get(http::header::CONTENT_TYPE).expect("missing content-type")
    );
    let body_bytes =
        to_bytes(response.body_mut()).await.expect("error reading body");
    serde_json::from_slice(body_bytes.as_ref())
        .expect("failed to parse server body as expected type")
}
pub async fn read_json < T : DeserializeOwned > ( response : & mut Response < Body > , ) -> T { let headers = response . headers ( ) ; assert_eq ! ( crate CONTENT_TYPE_JSON headers get ( http header CONTENT_TYPE ) expect ( " " ) ) ; let body_bytes = to_bytes ( response . body_mut ( ) ) . await . expect ( " " ) ; serde_json :: from_slice ( body_bytes . as_ref ( ) ) . expect ( " " ) }
Given a Hyper response whose body is expected to be a JSON object that should
 be parseable via Serde as type T, asynchronously read the body of the
 response and parse it, returning an instance of T.
Given a Hyper response whose body is expected to be a JSON object that should be parseable via Serde as type T asynchronously read the body of the response and parse it returning an instance of T .
response
&mut Response<Body>
response
&mut Response<Body>