File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
aws_lambda_powertools/utilities/data_classes
tests/unit/data_classes/required_dependencies Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -437,7 +437,7 @@ class APIGatewayAuthorizerResponse:
437437 - https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html
438438 """
439439
440- path_regex = r"^[/.a-zA-Z0-9-_\*]+$"
440+ path_regex = r"^[/.a-zA-Z0-9\ -_\*\{\}\+ ]+$"
441441 """The regular expression used to validate resource paths for the policy"""
442442
443443 def __init__ (
Original file line number Diff line number Diff line change @@ -200,6 +200,40 @@ def test_authorizer_response_allow_route_with_underscore(builder: APIGatewayAuth
200200 }
201201
202202
203+ def test_authorizer_response_allow_route_with_proxy_plus (builder : APIGatewayAuthorizerResponse ):
204+ builder .allow_route (http_method = "GET" , resource = "/{proxy+}" )
205+ assert builder .asdict () == {
206+ "principalId" : "foo" ,
207+ "policyDocument" : {
208+ "Version" : "2012-10-17" ,
209+ "Statement" : [
210+ {
211+ "Action" : "execute-api:Invoke" ,
212+ "Effect" : "Allow" ,
213+ "Resource" : ["arn:aws:execute-api:us-west-1:123456789:fantom/dev/GET/{proxy+}" ],
214+ },
215+ ],
216+ },
217+ }
218+
219+
220+ def test_authorizer_response_allow_route_with_path_parameter (builder : APIGatewayAuthorizerResponse ):
221+ builder .allow_route (http_method = "GET" , resource = "/users/{user_id}" )
222+ assert builder .asdict () == {
223+ "principalId" : "foo" ,
224+ "policyDocument" : {
225+ "Version" : "2012-10-17" ,
226+ "Statement" : [
227+ {
228+ "Action" : "execute-api:Invoke" ,
229+ "Effect" : "Allow" ,
230+ "Resource" : ["arn:aws:execute-api:us-west-1:123456789:fantom/dev/GET/users/{user_id}" ],
231+ },
232+ ],
233+ },
234+ }
235+
236+
203237def test_parse_api_gateway_arn_with_resource ():
204238 mock_event = {
205239 "type" : "TOKEN" ,
You can’t perform that action at this time.
0 commit comments