You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While HTTP Headers are case-insensitive, I've heard that casing can be an issue with API GW... not sure if that is what is going on, but effectively right now I am doing something like the below to just get a slice of native http.Cookie to work with.
func ParseCookies(headers map[string]string) []*http.Cookie {
header := http.Header{}
val, ok := headers["Cookie"]
if ok {
header.Add("Cookie", val)
}
val, ok = headers["cookie"]
if ok {
header.Add("Cookie", val)
}
request := http.Request{Header: header}
return request.Cookies()
}
I think though it would be event better if the event exposed a "GetCookie" method, something like:
func GetCookie(headers map[string]string, cookieName string) (*http.Cookie, error) {
header := http.Header{}
val, ok := headers["Cookie"]
if ok {
header.Add("Cookie", val)
}
val, ok = headers["cookie"]
if ok {
header.Add("Cookie", val)
}
request := http.Request{Header: header}
return request.Cookie(cookieName)
}
Which could be used to try and get a cookie, or idiomatically an error
https://pkg.go.dev/github.com/aws/aws-lambda-go/events@v1.40.0#APIGatewayV2CustomAuthorizerV2Request.Cookies
I am unable to get the Cookies portion to populate in the AuthorizerV2Request object.
I am able to see cookies under the
cookie
Header, but the Cookies object itself seems to have no function.The text was updated successfully, but these errors were encountered: