diff --git a/moto/awslambda/responses.py b/moto/awslambda/responses.py index 8ba86f8bc..f965ad2e0 100644 --- a/moto/awslambda/responses.py +++ b/moto/awslambda/responses.py @@ -209,6 +209,7 @@ class LambdaResponse(BaseResponse): function_name, qualifier, self.body, self.headers, response_headers ) if payload: + response_headers["content-type"] = "application/json" if request.headers.get("X-Amz-Invocation-Type") == "Event": status_code = 202 elif request.headers.get("X-Amz-Invocation-Type") == "DryRun": diff --git a/tests/test_awslambda/test_lambda.py b/tests/test_awslambda/test_lambda.py index d2949aea4..fa02e282d 100644 --- a/tests/test_awslambda/test_lambda.py +++ b/tests/test_awslambda/test_lambda.py @@ -157,6 +157,9 @@ def test_invoke_requestresponse_function(invocation_type): assert False, success_result["Payload"].read().decode("utf-8") success_result["StatusCode"].should.equal(200) + success_result["ResponseMetadata"]["HTTPHeaders"]["content-type"].should.equal( + "application/json" + ) logs = base64.b64decode(success_result["LogResult"]).decode("utf-8") logs.should.contain("START RequestId:") @@ -172,6 +175,9 @@ def test_invoke_requestresponse_function(invocation_type): ) success_result["StatusCode"].should.equal(200) + success_result["ResponseMetadata"]["HTTPHeaders"]["content-type"].should.equal( + "application/json" + ) assert "LogResult" not in success_result