fix: return x-request-id in response headers for client-side tracing#1454
fix: return x-request-id in response headers for client-side tracing#1454Xenon010101 wants to merge 1 commit into
Conversation
The middleware generated a unique x-request-id for tracing but never sent it back to the client. Added res.setHeader so clients can correlate their requests with server-side logs. Closes Sachinchaurasiya360#1441 Signed-off-by: Xenon010101 <xenon010101@users.noreply.github.com>
|
Hi @Xenon010101, thanks for contributing to InternHack! 🎉 I have automatically:
Our workflows will now analyze your changes to classify:
Tip Ensure your PR description references the issue it resolves (e.g. Happy coding! 🚀 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe request-id tracing middleware in ChangesRequest-ID response header propagation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
x-request-id was generated for tracing but never returned to the client in response headers.
Root cause
The middleware in
server/src/index.tsgenerated a UUID onreq.headersbut never calledres.setHeader()to send it back.Changes
server/src/index.ts: Changed_restoresand addedres.setHeader("x-request-id", ...)after generating the IDVerification
CI failures
N/A
Before
Request ID generated but never returned to client.
After
All API responses include x-request-id header for client-side tracing.
Closes #1441
Summary by CodeRabbit