File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 4
4
"context"
5
5
"net/http"
6
6
"strings"
7
-
8
- "github.com/labstack/echo/v4"
9
- "github.com/webdevelop-pro/go-common/context/keys"
10
7
)
11
8
12
9
type ContextKey rune
@@ -19,6 +16,8 @@ const (
19
16
IdentityID
20
17
LogInfo
21
18
RequestLogID
19
+
20
+ RequestIDStr = "X-Request-Id"
22
21
)
23
22
24
23
func GetAsString (ctx context.Context , key ContextKey ) string {
@@ -72,10 +71,12 @@ func GetIPAddress(headers http.Header) string {
72
71
// Set values in ctx for
73
72
// RequestID, IPAddress
74
73
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" )
76
77
IP := GetIPAddress (headers )
77
78
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 )
80
81
return ctx
81
82
}
You can’t perform that action at this time.
0 commit comments