I am having a problem finding a way of how to access the cookie that is sent to my AWS Lambda. I have an API Gateway with lambda proxy integration (POST) to my Lambda.
From my client java program I am making an http POST request with body(Json) and with an HttpCookie in the CookieStore inside the CookieManager. This request goes to my Lambda where the body is printed to the console. This works fine but unfortunately I don't know how to access the cookie that was sent with the POST request. I am using Java 8 and APIGatewayProxyRequestEvent to get the body.
Can anybody please provide me some assistance on how to get the cookie from APIGatewayProxyRequestEvent event or maybe another workaround?
Thank you!
The cookies are sent in the
Headerswithin theAPIGatewayProxyRequestEventobject —request.Headers.Cookie.The important thing is to parse the cookies since values of
Headersare alwaysString.Here's how you can access it and create a key-value
HashMapso that it's easier to use.The output of that will look something like this: