hyperlane-plugin-problem-details 23.3.0

An RFC 9457 Problem Details (application/problem+json) error normalizer and builder plugin for the Hyperlane framework with zero-overhead 2xx/3xx fast path and automatic 4xx/5xx error structuring.
Documentation
use super::*;

/// Maps an HTTP status code to its standard RFC 9110 reason phrase title.
///
/// # Arguments
///
/// - `usize` - HTTP status code.
///
/// # Returns
///
/// - `&'static str` - Standard title string.
#[inline]
pub fn default_title_for_status(status: usize) -> &'static str {
    match status {
        400 => TITLE_BAD_REQUEST,
        401 => TITLE_UNAUTHORIZED,
        403 => TITLE_FORBIDDEN,
        404 => TITLE_NOT_FOUND,
        405 => TITLE_METHOD_NOT_ALLOWED,
        409 => TITLE_CONFLICT,
        413 => TITLE_PAYLOAD_TOO_LARGE,
        422 => TITLE_UNPROCESSABLE_ENTITY,
        429 => TITLE_TOO_MANY_REQUESTS,
        500 => TITLE_INTERNAL_SERVER_ERROR,
        502 => TITLE_BAD_GATEWAY,
        503 => TITLE_SERVICE_UNAVAILABLE,
        504 => TITLE_GATEWAY_TIMEOUT,
        _ => DEFAULT_ERROR_TITLE,
    }
}