mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Add rejection tracing to all extractors (#2584)
This commit is contained in:
@@ -81,11 +81,16 @@ impl IntoResponse for FormRejection {
|
||||
fn into_response(self) -> Response {
|
||||
match self {
|
||||
Self::RawFormRejection(inner) => inner.into_response(),
|
||||
Self::FailedToDeserializeForm(inner) => (
|
||||
StatusCode::BAD_REQUEST,
|
||||
format!("Failed to deserialize form: {inner}"),
|
||||
)
|
||||
.into_response(),
|
||||
Self::FailedToDeserializeForm(inner) => {
|
||||
let body = format!("Failed to deserialize form: {inner}");
|
||||
let status = StatusCode::BAD_REQUEST;
|
||||
axum_core::__log_rejection!(
|
||||
rejection_type = Self,
|
||||
body_text = body,
|
||||
status = status,
|
||||
);
|
||||
(status, body).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +379,13 @@ pub struct InvalidBoundary;
|
||||
|
||||
impl IntoResponse for InvalidBoundary {
|
||||
fn into_response(self) -> Response {
|
||||
(self.status(), self.body_text()).into_response()
|
||||
let body = self.body_text();
|
||||
axum_core::__log_rejection!(
|
||||
rejection_type = Self,
|
||||
body_text = body,
|
||||
status = self.status(),
|
||||
);
|
||||
(self.status(), body).into_response()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,11 +114,16 @@ pub enum QueryRejection {
|
||||
impl IntoResponse for QueryRejection {
|
||||
fn into_response(self) -> Response {
|
||||
match self {
|
||||
Self::FailedToDeserializeQueryString(inner) => (
|
||||
StatusCode::BAD_REQUEST,
|
||||
format!("Failed to deserialize query string: {inner}"),
|
||||
)
|
||||
.into_response(),
|
||||
Self::FailedToDeserializeQueryString(inner) => {
|
||||
let body = format!("Failed to deserialize query string: {inner}");
|
||||
let status = StatusCode::BAD_REQUEST;
|
||||
axum_core::__log_rejection!(
|
||||
rejection_type = Self,
|
||||
body_text = body,
|
||||
status = status,
|
||||
);
|
||||
(status, body).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user