Skip to content

Commit 4e32e7c

Browse files
authored
Fix linting errors: use canonical HTTP header casing (#16295)
golangci-lint --fix standardized header names to canonical form.
1 parent 5fbd94e commit 4e32e7c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/http/trace.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ import (
2424
// ExtractTraceID extracts the trace ID from the request headers.
2525
// It supports both W3C Trace Context (traceparent) and B3 (X-B3-TraceId) formats.
2626
func ExtractTraceID(h http.Header) string {
27-
if traceparent := h.Get("traceparent"); traceparent != "" {
27+
if traceparent := h.Get("Traceparent"); traceparent != "" {
2828
parts := strings.SplitN(traceparent, "-", 3)
2929
if len(parts) >= 2 {
3030
return parts[1]
3131
}
3232
}
3333

34-
if b3TraceID := h.Get("X-B3-TraceId"); b3TraceID != "" {
34+
if b3TraceID := h.Get("X-B3-Traceid"); b3TraceID != "" {
3535
return b3TraceID
3636
}
3737

pkg/http/trace_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func TestRequestLogTemplateWithTraceID(t *testing.T) {
147147
// Test with W3C Trace Context
148148
req := httptest.NewRequest(http.MethodPost, "http://example.com/api", nil)
149149

150-
req.Header.Set("traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01")
150+
req.Header.Set("Traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01")
151151

152152
resp := httptest.NewRecorder()
153153
logHandler.ServeHTTP(resp, req)

0 commit comments

Comments
 (0)