mirror of
https://github.com/adnanh/webhook.git
synced 2025-10-06 22:47:21 +00:00
chore: go mod vendor
This commit is contained in:
parent
f93670d9ae
commit
90fdae322f
429 changed files with 88019 additions and 123699 deletions
6
vendor/github.com/go-chi/chi/middleware/request_id.go
generated
vendored
6
vendor/github.com/go-chi/chi/middleware/request_id.go
generated
vendored
|
@ -20,6 +20,10 @@ type ctxKeyRequestID int
|
|||
// RequestIDKey is the key that holds the unique request ID in a request context.
|
||||
const RequestIDKey ctxKeyRequestID = 0
|
||||
|
||||
// RequestIDHeader is the name of the HTTP Header which contains the request id.
|
||||
// Exported so that it can be changed by developers
|
||||
var RequestIDHeader = "X-Request-Id"
|
||||
|
||||
var prefix string
|
||||
var reqid uint64
|
||||
|
||||
|
@ -63,7 +67,7 @@ func init() {
|
|||
func RequestID(next http.Handler) http.Handler {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
requestID := r.Header.Get("X-Request-Id")
|
||||
requestID := r.Header.Get(RequestIDHeader)
|
||||
if requestID == "" {
|
||||
myid := atomic.AddUint64(&reqid, 1)
|
||||
requestID = fmt.Sprintf("%s-%06d", prefix, myid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue