//! Helpers around the `X-Publish-Event` header that toggles telemetry events.
use actix_web::HttpRequest;

/// Returns `true` when `X-Publish-Event` equals `true` (case-insensitive).
pub fn get_x_publish_event(req: &HttpRequest) -> bool {
    req.headers()
        .get("X-Publish-Event")
        .and_then(|h| h.to_str().ok())
        .map(|s| s.eq_ignore_ascii_case("true"))
        .unwrap_or(false)
}
