I have got actix web api handler function, which receives body argument. The compiler warns that body
does not have to be mutable for the api_handler
. However, the handler calls a function which requires body to be mutable. Is it incorrect compiler's warning or I am doing something incorrectly?
async fn api_handler(_req: HttpRequest, mut body: web::Payload) -> Result<HttpResponse, Error> {
let body = utils::receive_body_as_string(body).await?;
...
}
pub async fn receive_body_as_string(mut body: actix_web::web::Payload) -> Result<String, actix_web::Error> {
...
}