Documentation
1
2
3
4
5
6
7
8
9
// Copyright 2022 Parthka. All rights reserved. MIT license.

use hyper::{Body, body};

// get request body
pub async fn read_response_body(req_body: Body) -> Result<String, hyper::Error> {
    let bytes = body::to_bytes(req_body).await;
    Ok(String::from_utf8(bytes?.to_vec()).expect("response was not valid utf-8"))
}