Skip to content

Commit 0a41994

Browse files
authored
Accepting cookie in small and capital C (#157)
* Accepting cookie in small and capital C * addressing code rabbit comments
1 parent 66daa46 commit 0a41994

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

jwt/jwt.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,14 @@ func JWTMiddleware() func(req events.APIGatewayProxyRequest) (events.APIGatewayP
182182
return handleMiddlewareResponse(http.StatusInternalServerError, "Internal server error")
183183
}
184184

185-
cookie := req.Headers["Cookie"]
185+
cookie := ""
186+
// Check for cookie header in case-insensitive manner
187+
for key, val := range req.Headers {
188+
if strings.ToLower(key) == "cookie" {
189+
cookie = val
190+
break
191+
}
192+
}
186193
if cookie == "" {
187194
return handleMiddlewareResponse(http.StatusUnauthorized, "Unauthenticated")
188195
}

0 commit comments

Comments
 (0)