mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-06-09 01:35:18 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
284c9377c2
commit
e14b203208
1 changed files with 2 additions and 2 deletions
|
|
@ -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<Body>, 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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue