@@ -667,6 +667,34 @@ describe('Updating stage cache settings', () => {
667667 } ) ;
668668 } ) ;
669669
670+ describe ( 'when an http endpoint path is empty' , ( ) => {
671+ before ( async ( ) => {
672+ let endpoint = given . a_serverless_function ( 'list-cats' )
673+ . withHttpEndpoint ( 'get' , '' , { enabled : true } ) ;
674+
675+ serverless = given . a_serverless_instance ( )
676+ . withApiGatewayCachingConfig ( )
677+ . withFunction ( endpoint )
678+ . forStage ( 'somestage' ) ;
679+ settings = new ApiGatewayCachingSettings ( serverless ) ;
680+
681+ restApiId = await given . a_rest_api_id_for_deployment ( serverless , settings ) ;
682+
683+ await when_updating_stage_cache_settings ( settings , serverless ) ;
684+
685+ requestsToAws = serverless . getRequestsToAws ( ) ;
686+ apiGatewayRequest = requestsToAws . find ( r => r . awsService == apiGatewayService && r . method == updateStageMethod ) ;
687+ } ) ;
688+
689+ it ( `should enable caching for the endpoint` , ( ) => {
690+ expect ( apiGatewayRequest . properties . patchOperations ) . to . deep . include ( {
691+ op : 'replace' ,
692+ path : `/~1/GET/caching/enabled` ,
693+ value : 'true'
694+ } ) ;
695+ } ) ;
696+ } ) ;
697+
670698 // https://github.com/DianaIonita/serverless-api-gateway-caching/issues/46
671699 describe ( 'When there are over twenty two http endpoints defined' , ( ) => {
672700 let requestsToAwsToUpdateStage , restApiId , expectedStageName ;
0 commit comments