Skip to content

Commit

Permalink
feat expose RequestIDHeaderKey globally
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Mar 18, 2024
1 parent fc932eb commit 203f2e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ func NewWithConfig(logger *slog.Logger, config Config) gin.HandlerFunc {
params[p.Key] = p.Value
}

requestID := c.GetHeader(requestIDHeaderKey)
requestID := c.GetHeader(RequestIDHeaderKey)
if config.WithRequestID {
if requestID == "" {
requestID = uuid.New().String()
c.Header(requestIDHeaderKey, requestID)
c.Header(RequestIDHeaderKey, requestID)
}
c.Set(requestIDCtx, requestID)
}
Expand Down

0 comments on commit 203f2e6

Please sign in to comment.