Skip to content

Commit

Permalink
Merge branch 'add-logger'
Browse files Browse the repository at this point in the history
  • Loading branch information
xlanor committed Feb 10, 2021
2 parents 2dbf71f + 9041454 commit 36e08f5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions loggerx/middleware_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func GetReqId(c *gin.Context) string {
return c.GetHeader("request-id")
return c.Request.Header.Get("request-id")
}

func UseRequestId() gin.HandlerFunc {
Expand All @@ -16,7 +16,6 @@ func UseRequestId() gin.HandlerFunc {
if reqId == "" {
reqId = uuid.Must(uuid.NewV4()).String()
}
c.Header("request-id", reqId)
c.Next()
c.Request.Header.Set("request-id", reqId)
}
}

0 comments on commit 36e08f5

Please sign in to comment.