request crate doesn't currently provide any functionality for processing request/response bodies -
Response both have a type parameter which defines what calling
.body() will return. It's up to the framework built on top of
http to define what these body types actually are.
So this raises the question, why does your
Request not have a type parameter? Is that pseudo-code/a typo, or does it actually work in your program?
If the latter, I think you're not actually working with the
http types, but something wrapping them. The
lambda_http crate, perhaps? The fact you're using
HandlerError makes me think that might be the case.
If you are using
Request is actually a type alias for
http::Request<lambda_http::Body>, so calling
.body() on it will return this type. You can match on that type to extract the body data.
That said, the body data will still be in string/byte form - you'll need to parse it somehow. A quick Google brought up
serde_urlencoded, which might be helpful.
lambda_http provides that functionality out of the box if you bring the
RequestExt trait into scope - you can then do
request.payload() to deserialize the body. This uses
serde_urlencoded under the hood.