Use correct error type if Json serialization fails

Fixes https://github.com/davidpdrsn/axum/issues/35
This commit is contained in:
David Pedersen 2021-07-22 13:26:14 +02:00
parent f32d325e55
commit a658c94f23

View file

@ -229,6 +229,7 @@ where
Ok(res) => res,
Err(err) => {
return Response::builder()
.status(StatusCode::INTERNAL_SERVER_ERROR)
.header(header::CONTENT_TYPE, "text/plain")
.body(Body::from(err.to_string()))
.unwrap();