Introduce Response type alias as a shorthand for Response<BoxBody> (#590)

* Introduce `Response` type alias as a shorthand

* Don't re-export `Response` at the crate root
This commit is contained in:
Kai Jewson
2021-12-05 19:16:46 +01:00
committed by GitHub
parent cbb34869d8
commit dfb06e721c
41 changed files with 210 additions and 237 deletions
+3 -4
View File
@@ -8,10 +8,9 @@
use axum::{
async_trait,
body::BoxBody,
extract::{FromRequest, RequestParts, TypedHeader},
http::{Response, StatusCode},
response::IntoResponse,
http::StatusCode,
response::{IntoResponse, Response},
routing::{get, post},
Json, Router,
};
@@ -141,7 +140,7 @@ where
}
impl IntoResponse for AuthError {
fn into_response(self) -> Response<BoxBody> {
fn into_response(self) -> Response {
let (status, error_message) = match self {
AuthError::WrongCredentials => (StatusCode::UNAUTHORIZED, "Wrong credentials"),
AuthError::MissingCredentials => (StatusCode::BAD_REQUEST, "Missing credentials"),