Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions slack_bolt/adapter/aws_lambda/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,17 @@ def handle(self, event, context):


def to_bolt_request(event) -> BoltRequest:
"""Note that this handler supports only the payload format 2.0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍

This means you can use this with HTTP API while REST API is not supported.

Read https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
for more details.
"""
body = event.get("body", "")
if event["isBase64Encoded"]:
body = base64.b64decode(body).decode("utf-8")
cookies: Sequence[str] = event.get("cookies", [])
if cookies is None or len(cookies) == 0:
# In the case of format v1
multiValueHeaders = event.get("multiValueHeaders", {})
cookies = multiValueHeaders.get("Cookie", [])
cookies = multiValueHeaders.get("cookie", [])
if len(cookies) == 0:
# Try using uppercase

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

cookies = multiValueHeaders.get("Cookie", [])
headers = event.get("headers", {})
headers["cookie"] = cookies
return BoltRequest(
Expand Down