Unable convert hyper::Body to string hyper 0.11.24

In a project we have the plan to use a web server for parsing JSON, our chosen web server APIs is hyper 0.11.24, but we have a problem with getting request body and converting it to string, our problem is about converting hyper::Body to string for parsing is JSON parser function.
I read the documentation, and I couldn't find any solution for doing that.

This is peace of my code:

            (&hyper::Method::Post, "/api") => {
                let mut response = hyper::Response::new();
                response.set_body(req.body());
                response
            }

I will be grateful if someone could help me solve my problem

Take a look at https://mgattozzi.com/hyper-async as an example.

1 Like