mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-04 02:01:23 +01:00
axum-core/macros: Avoid double body_text()
calls in rejection macros (#3110)
This commit is contained in:
parent
32a948e8ea
commit
7c934f2a83
1 changed files with 10 additions and 5 deletions
|
@ -49,12 +49,14 @@ macro_rules! __define_rejection {
|
||||||
|
|
||||||
impl $crate::response::IntoResponse for $name {
|
impl $crate::response::IntoResponse for $name {
|
||||||
fn into_response(self) -> $crate::response::Response {
|
fn into_response(self) -> $crate::response::Response {
|
||||||
|
let status = self.status();
|
||||||
|
|
||||||
$crate::__log_rejection!(
|
$crate::__log_rejection!(
|
||||||
rejection_type = $name,
|
rejection_type = $name,
|
||||||
body_text = $body,
|
body_text = $body,
|
||||||
status = http::StatusCode::$status,
|
status = status,
|
||||||
);
|
);
|
||||||
(self.status(), $body).into_response()
|
(status, $body).into_response()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,12 +108,15 @@ macro_rules! __define_rejection {
|
||||||
|
|
||||||
impl $crate::response::IntoResponse for $name {
|
impl $crate::response::IntoResponse for $name {
|
||||||
fn into_response(self) -> $crate::response::Response {
|
fn into_response(self) -> $crate::response::Response {
|
||||||
|
let status = self.status();
|
||||||
|
let body_text = self.body_text();
|
||||||
|
|
||||||
$crate::__log_rejection!(
|
$crate::__log_rejection!(
|
||||||
rejection_type = $name,
|
rejection_type = $name,
|
||||||
body_text = self.body_text(),
|
body_text = body_text,
|
||||||
status = http::StatusCode::$status,
|
status = status,
|
||||||
);
|
);
|
||||||
(self.status(), self.body_text()).into_response()
|
(status, body_text).into_response()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue