mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-22 00:00:17 +02:00
Make status codes for JsonRejection more precise (#868)
* Fix status codes for `JsonRejection` rejections Fixes #865 * Apply suggestions from code review Co-authored-by: Jonas Platte <[email protected]> Co-authored-by: Jonas Platte <[email protected]>
This commit is contained in:
co-authored by
Jonas Platte
parent
33ee55e52c
commit
437fe5b931
@@ -69,7 +69,7 @@ where
|
||||
Err(rejection) => {
|
||||
// convert the error from `axum::Json` into whatever we want
|
||||
let (status, body): (_, Cow<'_, str>) = match rejection {
|
||||
JsonRejection::InvalidJsonBody(err) => (
|
||||
JsonRejection::JsonDataError(err) => (
|
||||
StatusCode::BAD_REQUEST,
|
||||
format!("Invalid JSON request: {}", err).into(),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user