Merge pull request #2901 from kislyuk/patch-1

awslambda: Do not assume X-Amz-Invocation-Type is set
This commit is contained in:
Bert Blommers 2020-04-17 09:39:33 +01:00 committed by GitHub
commit 4f59a3584b
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