From ea4af2346c87731dd061d392249905fdf9eb238a Mon Sep 17 00:00:00 2001 From: Cesar Alvernaz Date: Thu, 19 May 2022 12:07:26 +0100 Subject: [PATCH] APIGateway V2: add authorizerPayloadFormatVersion to the authorizer (#5144) --- moto/apigatewayv2/responses.py | 4 +++- tests/test_apigatewayv2/test_apigatewayv2_authorizers.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/moto/apigatewayv2/responses.py b/moto/apigatewayv2/responses.py index 737277270..b025be40f 100644 --- a/moto/apigatewayv2/responses.py +++ b/moto/apigatewayv2/responses.py @@ -261,7 +261,9 @@ class ApiGatewayV2Response(BaseResponse): params = json.loads(self.body) auth_creds_arn = params.get("authorizerCredentialsArn") - auth_payload_format_version = params.get("authorizerPayloadFormatVersion") + auth_payload_format_version = ( + params.get("authorizerPayloadFormatVersion") or "2.0" + ) auth_result_ttl = params.get("authorizerResultTtlInSeconds") authorizer_type = params.get("authorizerType") authorizer_uri = params.get("authorizerUri") diff --git a/tests/test_apigatewayv2/test_apigatewayv2_authorizers.py b/tests/test_apigatewayv2/test_apigatewayv2_authorizers.py index 013a20d70..ad63f6e57 100644 --- a/tests/test_apigatewayv2/test_apigatewayv2_authorizers.py +++ b/tests/test_apigatewayv2/test_apigatewayv2_authorizers.py @@ -51,6 +51,7 @@ def test_create_authorizer(): {"Audience": ["a1"], "Issuer": "moto.com"} ) resp.should.have.key("Name").equals("auth1") + resp.should.have.key("AuthorizerPayloadFormatVersion").equals("2.0") @mock_apigatewayv2 @@ -67,6 +68,7 @@ def test_get_authorizer(): resp.should.have.key("AuthorizerId") resp.should.have.key("AuthorizerType").equals("REQUEST") resp.should.have.key("Name").equals("auth1") + resp.should.have.key("AuthorizerPayloadFormatVersion").equals("2.0") @mock_apigatewayv2