Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 30bd934

Browse files
committed
feat: client address (ip) in the http request directly
1 parent 3b512ab commit 30bd934

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/requestv2.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (r *RequestAccessorV2) EventToRequest(req events.APIGatewayV2HTTPRequest) (
123123

124124
path := req.RawPath
125125

126-
//if RawPath empty is, populate from request context
126+
// if RawPath empty is, populate from request context
127127
if len(path) == 0 {
128128
path = req.RequestContext.HTTP.Path
129129
}
@@ -158,6 +158,8 @@ func (r *RequestAccessorV2) EventToRequest(req events.APIGatewayV2HTTPRequest) (
158158
bytes.NewReader(decodedBody),
159159
)
160160

161+
httpRequest.RemoteAddr = req.RequestContext.HTTP.SourceIP
162+
161163
if err != nil {
162164
fmt.Printf("Could not convert request %s:%s to http.Request\n", req.RequestContext.HTTP.Method, req.RequestContext.HTTP.Path)
163165
log.Println(err)

0 commit comments

Comments
 (0)