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
13 changes: 3 additions & 10 deletions src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ mod axum_impl {
use axum::{
Json,
http::{
HeaderValue, StatusCode as AxumStatus,
HeaderValue,
header::{RETRY_AFTER, WWW_AUTHENTICATE}
},
response::{IntoResponse, Response}
Expand All @@ -268,8 +268,7 @@ mod axum_impl {

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

// Serialize JSON body first (borrow self for payload).
let mut response = (status, Json(&self)).into_response();
Expand Down Expand Up @@ -315,10 +314,7 @@ mod actix_impl {
use actix_web::{
HttpRequest, HttpResponse, Responder,
body::BoxBody,
http::{
StatusCode as ActixStatus,
header::{RETRY_AFTER, WWW_AUTHENTICATE}
}
http::header::{RETRY_AFTER, WWW_AUTHENTICATE}
};

use super::ErrorResponse;
Expand All @@ -328,9 +324,6 @@ mod actix_impl {

fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
let status = self.status_code();
let status = ActixStatus::from_u16(status.as_u16())
.unwrap_or(ActixStatus::INTERNAL_SERVER_ERROR);

let mut builder = HttpResponse::build(status);
Comment on lines 325 to 327

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Restore Actix status code conversion

The refactor now passes self.status_code() directly into HttpResponse::build, but status_code() produces a http v1::StatusCode while Actix 4 still re‑exports http v0.2::StatusCode. Previously the code converted through ActixStatus::from_u16(...) to bridge the two versions. With that conversion removed, enabling the actix feature causes this module to fail to compile because the types are different. Re‑introducing the conversion or aligning the http dependency is required for builds with the Actix feature enabled.

Useful? React with 👍 / 👎.

if let Some(retry) = self.retry {
builder.insert_header((RETRY_AFTER, retry.after_seconds.to_string()));
Expand Down
Loading