diff --git a/axum-extra/src/protobuf.rs b/axum-extra/src/protobuf.rs index e3c4b51d..912f4a1d 100644 --- a/axum-extra/src/protobuf.rs +++ b/axum-extra/src/protobuf.rs @@ -3,7 +3,7 @@ use axum::{ async_trait, extract::{rejection::BytesRejection, FromRequest, Request}, - response::{IntoResponse, Response}, + response::{IntoResponse, IntoResponseFailed, Response}, }; use bytes::{Bytes, BytesMut}; use http::StatusCode; @@ -124,7 +124,12 @@ where let mut buf = BytesMut::with_capacity(128); match &self.0.encode(&mut buf) { Ok(()) => buf.into_response(), - Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response(), + Err(err) => ( + StatusCode::INTERNAL_SERVER_ERROR, + IntoResponseFailed, + err.to_string(), + ) + .into_response(), } } } diff --git a/axum-extra/src/response/erased_json.rs b/axum-extra/src/response/erased_json.rs index 6e94a267..f820b122 100644 --- a/axum-extra/src/response/erased_json.rs +++ b/axum-extra/src/response/erased_json.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use axum::{ http::{header, HeaderValue, StatusCode}, - response::{IntoResponse, Response}, + response::{IntoResponse, IntoResponseFailed, Response}, }; use bytes::{BufMut, Bytes, BytesMut}; use serde::Serialize; @@ -68,7 +68,12 @@ impl IntoResponse for ErasedJson { bytes, ) .into_response(), - Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response(), + Err(err) => ( + StatusCode::INTERNAL_SERVER_ERROR, + IntoResponseFailed, + err.to_string(), + ) + .into_response(), } } } diff --git a/axum/src/form.rs b/axum/src/form.rs index 5f42b303..b38363b4 100644 --- a/axum/src/form.rs +++ b/axum/src/form.rs @@ -1,7 +1,7 @@ use crate::extract::Request; use crate::extract::{rejection::*, FromRequest, RawForm}; use async_trait::async_trait; -use axum_core::response::{IntoResponse, Response}; +use axum_core::response::{IntoResponse, IntoResponseFailed, Response}; use axum_core::RequestExt; use http::header::CONTENT_TYPE; use http::StatusCode; @@ -115,7 +115,12 @@ where body, ) .into_response(), - Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response(), + Err(err) => ( + StatusCode::INTERNAL_SERVER_ERROR, + IntoResponseFailed, + err.to_string(), + ) + .into_response(), } } } diff --git a/axum/src/response/mod.rs b/axum/src/response/mod.rs index 8d248659..0710c64d 100644 --- a/axum/src/response/mod.rs +++ b/axum/src/response/mod.rs @@ -21,7 +21,8 @@ pub use crate::Extension; #[doc(inline)] pub use axum_core::response::{ - AppendHeaders, ErrorResponse, IntoResponse, IntoResponseParts, Response, ResponseParts, Result, + AppendHeaders, ErrorResponse, IntoResponse, IntoResponseFailed, IntoResponseParts, Response, + ResponseParts, Result, }; #[doc(inline)]