mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
fmt(customize-extractor-error): missing fmt
This commit is contained in:
@@ -5,10 +5,8 @@
|
|||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::rejection::JsonRejection,
|
extract::rejection::JsonRejection, http::StatusCode, response::IntoResponse, routing::post,
|
||||||
http::StatusCode,
|
Json, Router,
|
||||||
response::IntoResponse,
|
|
||||||
routing::post, Json, Router,
|
|
||||||
};
|
};
|
||||||
use axum_extra::extract::WithRejection;
|
use axum_extra::extract::WithRejection;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@@ -42,7 +40,7 @@ async fn handler(
|
|||||||
// `WithRejection` will extract `Json<User>` from the request. If the
|
// `WithRejection` will extract `Json<User>` from the request. If the
|
||||||
// extraction fails, a `MyRejection` will be created from `JsonResponse` and
|
// extraction fails, a `MyRejection` will be created from `JsonResponse` and
|
||||||
// returned to the client
|
// returned to the client
|
||||||
WithRejection(Json(user), _): WithRejection<Json<User>, MyRejection>
|
WithRejection(Json(user), _): WithRejection<Json<User>, MyRejection>,
|
||||||
) {
|
) {
|
||||||
dbg!(&user);
|
dbg!(&user);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user