From e14b2032080d1fafedd46ff77b54cadda3fe675c Mon Sep 17 00:00:00 2001 From: Ragnor Comerford Date: Sun, 26 Apr 2026 12:05:19 +0200 Subject: [PATCH] Reuse X_REQUEST_ID constant for inbound header lookup Both Cursor Bugbot and Cubic flagged that the inbound `headers().get(...)` call constructed `HeaderName::from_static("x-request-id")` inline instead of reusing the `X_REQUEST_ID` constant defined at the top of the file. The two were already kept in sync by both being `from_static("x-request-id")`, but a future rename would have to touch both sites or risk silent drift between read and write. Also drops the now-unused `header` module import. Co-Authored-By: Claude Opus 4.7 --- crates/omnigraph-server/src/request_id.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/omnigraph-server/src/request_id.rs b/crates/omnigraph-server/src/request_id.rs index cae5b8b..3d68a0f 100644 --- a/crates/omnigraph-server/src/request_id.rs +++ b/crates/omnigraph-server/src/request_id.rs @@ -9,7 +9,7 @@ use axum::{ body::Body, extract::Request, - http::{HeaderName, HeaderValue, header}, + http::{HeaderName, HeaderValue}, middleware::Next, response::Response, }; @@ -40,7 +40,7 @@ fn is_valid_inbound(raw: &str) -> bool { pub async fn request_id_middleware(mut req: Request, next: Next) -> Response { let inbound = req .headers() - .get(header::HeaderName::from_static("x-request-id")) + .get(&X_REQUEST_ID) .and_then(|v| v.to_str().ok()) .filter(|raw| is_valid_inbound(raw));