Skip to content

Commit 14cfa49

Browse files
committed
fixed import
1 parent b69a43e commit 14cfa49

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

context/keys/keys.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import (
44
"context"
55
"net/http"
66
"strings"
7-
8-
"github.com/labstack/echo/v4"
9-
"github.com/webdevelop-pro/go-common/context/keys"
107
)
118

129
type ContextKey rune
@@ -19,6 +16,8 @@ const (
1916
IdentityID
2017
LogInfo
2118
RequestLogID
19+
20+
RequestIDStr = "X-Request-Id"
2221
)
2322

2423
func GetAsString(ctx context.Context, key ContextKey) string {
@@ -72,10 +71,12 @@ func GetIPAddress(headers http.Header) string {
7271
// Set values in ctx for
7372
// RequestID, IPAddress
7473
func SetDefaultHTTPCtx(ctx context.Context, headers http.Header) context.Context {
75-
requestID := headers.Get(echo.HeaderXRequestID)
74+
// so we don't need echo here
75+
// requestID := headers.Get(echo.HeaderXRequestID)
76+
requestID := headers.Get("X-Request-Id")
7677
IP := GetIPAddress(headers)
7778

78-
ctx = keys.SetCtxValue(ctx, keys.RequestID, requestID)
79-
ctx = keys.SetCtxValue(ctx, keys.IPAddress, IP)
79+
ctx = SetCtxValue(ctx, RequestID, requestID)
80+
ctx = SetCtxValue(ctx, IPAddress, IP)
8081
return ctx
8182
}

0 commit comments

Comments
 (0)