Skip to main content

fail_status

Function fail_status 

Source
pub fn fail_status(
    http_status: u16,
    code: i32,
    msg: impl Into<Cow<'static, str>>,
) -> Response<()>
Available on crate feature resputil only.
Expand description

带 HTTP 状态码的失败响应 (data 为空对象), 用于 401 / 403 / 429 等需按 HTTP 状态拦截的场景; 非法或 1xx 状态码矫正为 500, 避免 1xx 语义破坏 JSON 响应体