diff --git a/axum-core/src/macros.rs b/axum-core/src/macros.rs index 2fab243202..68073c5d71 100644 --- a/axum-core/src/macros.rs +++ b/axum-core/src/macros.rs @@ -50,7 +50,7 @@ macro_rules! __define_rejection { impl $name { /// Get the response body text used for this rejection. pub fn body_text(&self) -> String { - $body.into() + self.to_string() } /// Get the status code used for this rejection. @@ -107,7 +107,7 @@ macro_rules! __define_rejection { /// Get the response body text used for this rejection. pub fn body_text(&self) -> String { - format!(concat!($body, ": {}"), self.0).into() + self.to_string() } /// Get the status code used for this rejection.