@@ -903,3 +903,42 @@ def foo(app: ApiGatewayResolver, account_id):
903
903
# THEN process event correctly
904
904
assert result ["statusCode" ] == 200
905
905
assert result ["headers" ]["Content-Type" ] == content_types .APPLICATION_JSON
906
+
907
+
908
+ def test_api_gateway_app_proxy_with_prefix ():
909
+ # GIVEN a Blueprint with registered routes
910
+ # AND a prefix is defined during the registration
911
+ app = ApiGatewayResolver ()
912
+ blueprint = Blueprint ()
913
+
914
+ @blueprint .get (rule = "/path" )
915
+ def foo (app : ApiGatewayResolver ):
916
+ return {}
917
+
918
+ app .register_blueprint (blueprint , prefix = "/my" )
919
+ # WHEN calling the event handler after applying routes from blueprint object
920
+ result = app (LOAD_GW_EVENT , {})
921
+
922
+ # THEN process event correctly
923
+ assert result ["statusCode" ] == 200
924
+ assert result ["headers" ]["Content-Type" ] == content_types .APPLICATION_JSON
925
+
926
+
927
+ def test_api_gateway_app_proxy_with_prefix_equals_path ():
928
+ # GIVEN a Blueprint with registered routes
929
+ # AND a prefix is defined during the registration
930
+ app = ApiGatewayResolver ()
931
+ blueprint = Blueprint ()
932
+
933
+ @blueprint .get (rule = "/" )
934
+ def foo (app : ApiGatewayResolver ):
935
+ return {}
936
+
937
+ app .register_blueprint (blueprint , prefix = "/my/path" )
938
+ # WHEN calling the event handler after applying routes from blueprint object
939
+ # WITH the request path matching the registration prefix
940
+ result = app (LOAD_GW_EVENT , {})
941
+
942
+ # THEN process event correctly
943
+ assert result ["statusCode" ] == 200
944
+ assert result ["headers" ]["Content-Type" ] == content_types .APPLICATION_JSON
0 commit comments