Skip to content

Commit cd85e58

Browse files
committed
chore(aws_lambda): remove inline comments per review
1 parent 5ef55c6 commit cd85e58

2 files changed

Lines changed: 0 additions & 10 deletions

File tree

‎slack_bolt/adapter/aws_lambda/handler.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ def handle(self, event, context):
7171

7272

7373
def to_bolt_request(event) -> BoltRequest:
74-
# API Gateway sends null (not a missing key) for fields that have no value,
75-
# such as "headers", "multiValueHeaders" and "queryStringParameters".
76-
# Every lookup below treats None the same as a missing key.
7774
body = event.get("body") or ""
7875
if event.get("isBase64Encoded") is True and body:
7976
body = base64.b64decode(body).decode("utf-8")
@@ -85,7 +82,6 @@ def to_bolt_request(event) -> BoltRequest:
8582
if len(cookies) == 0:
8683
# Try using uppercase
8784
cookies = multiValueHeaders.get("Cookie") or []
88-
# Copy the headers so the caller's event dict is left untouched
8985
headers = dict(event.get("headers") or {})
9086
headers["cookie"] = cookies
9187
return BoltRequest(

‎tests/adapter_tests/aws/test_aws_lambda.py‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ def test_not_found(self):
7272
assert response["statusCode"] == 404
7373

7474
def test_null_fields_in_api_gateway_event(self):
75-
# API Gateway sends null for headers, multiValueHeaders and queryStringParameters
76-
# when the request has none. These used to crash before the request was dispatched.
7775
app = App(client=self.web_client, signing_secret=self.signing_secret)
7876
event = {
7977
"httpMethod": "POST",
@@ -85,17 +83,13 @@ def test_null_fields_in_api_gateway_event(self):
8583
"isBase64Encoded": False,
8684
}
8785
response = SlackRequestHandler(app).handle(event, self.context)
88-
# No signature headers, so the request is rejected rather than crashing
8986
assert response["statusCode"] == 401
90-
# The caller's event must not be modified
9187
assert event["headers"] is None
9288

9389
def test_missing_is_base64_encoded_and_null_body(self):
9490
app = App(client=self.web_client, signing_secret=self.signing_secret)
95-
# isBase64Encoded is absent (for example when invoked from a test tool)
9691
event = {"requestContext": {"http": {"method": "POST"}}, "headers": {}, "body": "{}"}
9792
assert SlackRequestHandler(app).handle(event, self.context)["statusCode"] == 401
98-
# isBase64Encoded is true but the body is null
9993
event = {"requestContext": {"http": {"method": "POST"}}, "headers": {}, "body": None, "isBase64Encoded": True}
10094
assert SlackRequestHandler(app).handle(event, self.context)["statusCode"] == 401
10195

0 commit comments

Comments
 (0)