Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ impl ErrorResponse {
///
/// # Examples
///

/// ```
/// use http::StatusCode;
/// use masterror::{AppCode, ErrorResponse};
Expand Down Expand Up @@ -258,7 +259,7 @@ mod axum_impl {
use axum::{
Json,
http::{
HeaderValue,
HeaderValue, StatusCode as AxumStatus,
header::{RETRY_AFTER, WWW_AUTHENTICATE}
},
response::{IntoResponse, Response}
Expand All @@ -269,7 +270,8 @@ mod axum_impl {

impl IntoResponse for ErrorResponse {
fn into_response(self) -> Response {
let status = self.status_code();
let status =
AxumStatus::from_u16(self.status).unwrap_or(AxumStatus::INTERNAL_SERVER_ERROR);

// Serialize JSON body first (borrow self for payload).
let mut response = (status, Json(&self)).into_response();
Expand Down
Loading