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
Activity
[-]event Cookies is always empty[/-][+]Authorizer Event Cookies is always empty[/+]weaverjess commentedon Apr 27, 2023
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.I think though it would be event better if the event exposed a "GetCookie" method, something like:
Which could be used to try and get a cookie, or idiomatically an error