Remove the associated Body type on IntoResponse (#571)

This commit is contained in:
Kai Jewson
2021-11-28 18:52:18 +01:00
committed by GitHub
parent decdd4c948
commit 2b6dba49cb
25 changed files with 171 additions and 358 deletions
+3 -6
View File
@@ -12,7 +12,7 @@
use async_trait::async_trait;
use axum::{
body::{Bytes, Full},
body::BoxBody,
extract::{Form, FromRequest, RequestParts},
http::{Response, StatusCode},
response::{Html, IntoResponse},
@@ -20,7 +20,7 @@ use axum::{
BoxError, Router,
};
use serde::{de::DeserializeOwned, Deserialize};
use std::{convert::Infallible, net::SocketAddr};
use std::net::SocketAddr;
use thiserror::Error;
use validator::Validate;
@@ -84,10 +84,7 @@ pub enum ServerError {
}
impl IntoResponse for ServerError {
type Body = Full<Bytes>;
type BodyError = Infallible;
fn into_response(self) -> Response<Self::Body> {
fn into_response(self) -> Response<BoxBody> {
match self {
ServerError::ValidationError(_) => {
let message = format!("Input validation error: [{}]", self).replace("\n", ", ");