@@ -81,7 +81,7 @@ describe("Cloudflare Response Store Worker", () => {
8181 }
8282 } ) ;
8383
84- it ( "uses one pathname key for default App pages but keeps explicit public query variants" , async ( ) => {
84+ it ( "shares proven App pages but preserves unproven and explicit- public query variants" , async ( ) => {
8585 const keys : string [ ] = [ ] ;
8686 const store = {
8787 fetch : vi . fn ( async ( request : Request ) => {
@@ -101,7 +101,7 @@ describe("Cloudflare Response Store Worker", () => {
101101 {
102102 kind : "app-page" ,
103103 resolvedUrl : new URL ( request . url ) . pathname + new URL ( request . url ) . search ,
104- cacheability : { policyHeaders : null } ,
104+ cacheability : { policyHeaders : null , queryIndependentCandidate : true } ,
105105 } ,
106106 { cache : "shared" } ,
107107 ) ,
@@ -118,7 +118,7 @@ describe("Cloudflare Response Store Worker", () => {
118118 {
119119 kind : "app-page" ,
120120 resolvedUrl : new URL ( request . url ) . pathname + new URL ( request . url ) . search ,
121- cacheability : { policyHeaders : [ [ "Cache-Control" , "public, s-maxage=30" ] ] } ,
121+ cacheability : { policyHeaders : null } ,
122122 } ,
123123 { cache : "shared" } ,
124124 ) ,
@@ -127,6 +127,22 @@ describe("Cloudflare Response Store Worker", () => {
127127 await handler . fetch ( new Request ( url ) , { } as never , context ) ;
128128 }
129129 expect ( keys [ 2 ] ) . not . toBe ( keys [ 3 ] ) ;
130+
131+ stages . request . mockImplementation ( ( request , _env , _ctx , dispatch ) =>
132+ dispatch (
133+ request ,
134+ {
135+ kind : "app-page" ,
136+ resolvedUrl : new URL ( request . url ) . pathname + new URL ( request . url ) . search ,
137+ cacheability : { policyHeaders : [ [ "Cache-Control" , "public, s-maxage=30" ] ] } ,
138+ } ,
139+ { cache : "shared" } ,
140+ ) ,
141+ ) ;
142+ for ( const url of [ "https://example.com/page?q=first" , "https://example.com/page?q=second" ] ) {
143+ await handler . fetch ( new Request ( url ) , { } as never , context ) ;
144+ }
145+ expect ( keys [ 4 ] ) . not . toBe ( keys [ 5 ] ) ;
130146 } ) ;
131147
132148 it ( "sanitizes response-stage props once on cache hits" , async ( ) => {
0 commit comments