samber / slog-gin

🚨 Gin middleware for slog logger
https://pkg.go.dev/github.com/samber/slog-gin
MIT License
89 stars 13 forks source link

fix: use existing x-header-id header if set #16

Closed tnyeanderson closed 3 months ago

tnyeanderson commented 4 months ago

Currently, if config.WithRequestID == true, a random request ID is generated, added to the context, and set in the request headers (x-header-id).

The x-header-id may already exist (ex: using envoy/istio in a kubernetes cluster), so we should use that if it's available instead of clobbering its value with our own.

tnyeanderson commented 3 months ago

Hi @samber, just gently pinging for this :)

samber commented 3 months ago

Hi @tnyeanderson and sorry for the delay.

Let's merge.