diff options
Diffstat (limited to 'middleware/request_id.go')
-rw-r--r-- | middleware/request_id.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/middleware/request_id.go b/middleware/request_id.go index 016b44a..feb5afa 100644 --- a/middleware/request_id.go +++ b/middleware/request_id.go @@ -4,6 +4,7 @@ import ( "context" "net/http" + "go.neonxp.ru/mux/ctxlib" "go.neonxp.ru/objectid" ) @@ -17,12 +18,12 @@ func RequestID(next http.Handler) http.Handler { requestID = objectid.New().String() } - next.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), requestIDKey, requestID))) + next.ServeHTTP(w, r.WithContext(context.WithValue(r.Context(), ctxlib.RequestID, requestID))) }) } func GetRequestID(r *http.Request) string { - rid := r.Context().Value(requestIDKey) + rid := r.Context().Value(ctxlib.RequestID) if rid == nil { return "" } |