Skip to content

Commit 05951c6

Browse files
authored
Try lower then uppercase key value to extract cookie (#451)
1 parent 4ec4444 commit 05951c6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

slack_bolt/adapter/aws_lambda/handler.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,17 @@ def handle(self, event, context):
7575

7676

7777
def to_bolt_request(event) -> BoltRequest:
78-
"""Note that this handler supports only the payload format 2.0.
79-
This means you can use this with HTTP API while REST API is not supported.
80-
81-
Read https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
82-
for more details.
83-
"""
8478
body = event.get("body", "")
8579
if event["isBase64Encoded"]:
8680
body = base64.b64decode(body).decode("utf-8")
8781
cookies: Sequence[str] = event.get("cookies", [])
8882
if cookies is None or len(cookies) == 0:
8983
# In the case of format v1
9084
multiValueHeaders = event.get("multiValueHeaders", {})
91-
cookies = multiValueHeaders.get("Cookie", [])
85+
cookies = multiValueHeaders.get("cookie", [])
86+
if len(cookies) == 0:
87+
# Try using uppercase
88+
cookies = multiValueHeaders.get("Cookie", [])
9289
headers = event.get("headers", {})
9390
headers["cookie"] = cookies
9491
return BoltRequest(

0 commit comments

Comments
 (0)