hyperlane-plugin-timeout 23.3.0

A per-route and global request deadline budget plugin for the Hyperlane framework with X-Request-Timeout clamping, Context RequestDeadline propagation, timeout_future async helper, and 504 Gateway Timeout enforcement.
Documentation
/// Context attribute key storing the active [`RequestDeadline`].
pub const ATTR_REQUEST_DEADLINE: &str = "hyperlane_plugin_timeout.deadline";

/// Default global request timeout budget in milliseconds (`30_000` ms).
pub const DEFAULT_TIMEOUT_MS: u64 = 30_000;

/// Default inbound header parsed for client-requested tighter deadlines (`x-request-timeout`).
pub const DEFAULT_TIMEOUT_HEADER: &str = "x-request-timeout";

/// Optional response header recording remaining request budget in milliseconds (`x-timeout-remaining-ms`).
pub const HEADER_TIMEOUT_REMAINING_MS: &str = "x-timeout-remaining-ms";

/// Default `Content-Type` for expired deadline responses.
pub const DEFAULT_TIMEOUT_CONTENT_TYPE: &str = "application/json; charset=utf-8";

/// Default JSON body emitted when a request deadline expires.
pub const DEFAULT_TIMEOUT_BODY: &[u8] =
    br#"{"error":"gateway_timeout","message":"request deadline exceeded"}"#;

/// Error message returned when [`timeout_future`] expires.
pub(crate) const ERR_DEADLINE_EXCEEDED: &str = "request deadline exceeded";

/// Root slash path constant.
pub(crate) const ROOT_SLASH: &str = "/";