awslambda: Do not assume X-Amz-Invocation-Type is set

This commit is contained in:
Andrey Kislyuk 2020-04-16 21:28:27 -07:00 committed by GitHub
parent bdeeeb701a
commit 76a249c0ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,9 +184,9 @@ class LambdaResponse(BaseResponse):
function_name, qualifier, self.body, self.headers, response_headers
)
if payload:
if request.headers["X-Amz-Invocation-Type"] == "Event":
if request.headers.get("X-Amz-Invocation-Type") == "Event":
status_code = 202
elif request.headers["X-Amz-Invocation-Type"] == "DryRun":
elif request.headers.get("X-Amz-Invocation-Type") == "DryRun":
status_code = 204
else:
status_code = 200