summaryrefslogtreecommitdiff
path: root/request_id.go
diff options
context:
space:
mode:
Diffstat (limited to 'request_id.go')
-rw-r--r--request_id.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/request_id.go b/request_id.go
index b3650ef..0e9a521 100644
--- a/request_id.go
+++ b/request_id.go
@@ -4,7 +4,7 @@ import (
"context"
"net/http"
- "github.com/google/uuid"
+ "go.neonxp.ru/objectid"
)
type ctxKeyRequestID int
@@ -15,10 +15,11 @@ const (
)
func RequestID(next http.Handler) http.Handler {
+ objectid.Seed()
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
requestID := r.Header.Get(RequestIDHeader)
if requestID == "" {
- requestID = uuid.NewString()
+ requestID = objectid.New().String()
}
next.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), RequestIDKey, requestID)))