diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-09-17 01:19:25 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-09-17 01:19:25 +0300 |
commit | a054f480adf26e90ddcb66408688486704ab7094 (patch) | |
tree | 4600b6e7633979e1a4b94cfcaeb7ddf156733575 /middleware/request_id.go | |
parent | 5094ebf213243023c6325310b3f710a0974025dd (diff) |
simple handlerv0.0.2
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 "" } |