@@ -80,12 +80,28 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
8080 revalidateApiBasePath : '/api/revalidate-no-await' ,
8181 expectedH1Content : 'Product not-prerendered-and-not-awaited-revalidation' ,
8282 } ,
83+ {
84+ label :
85+ 'prerendered page with dynamic path and awaited res.revalidate() - non-ASCII variant' ,
86+ prerendered : true ,
87+ pagePath : '/products/事前レンダリング,test' ,
88+ revalidateApiBasePath : '/api/revalidate' ,
89+ expectedH1Content : 'Product 事前レンダリング,test' ,
90+ } ,
91+ {
92+ label :
93+ 'not prerendered page with dynamic path and awaited res.revalidate() - non-ASCII variant' ,
94+ prerendered : false ,
95+ pagePath : '/products/事前レンダリングされていない,test' ,
96+ revalidateApiBasePath : '/api/revalidate' ,
97+ expectedH1Content : 'Product 事前レンダリングされていない,test' ,
98+ } ,
8399 ] ) {
84100 test ( label , async ( { page, pollUntilHeadersMatch, pageRouter } ) => {
85101 // in case there is retry or some other test did hit that path before
86102 // we want to make sure that cdn cache is not warmed up
87103 const purgeCdnCache = await page . goto (
88- new URL ( `/api/purge-cdn?path=${ pagePath } ` , pageRouter . url ) . href ,
104+ new URL ( `/api/purge-cdn?path=${ encodeURI ( pagePath ) } ` , pageRouter . url ) . href ,
89105 )
90106 expect ( purgeCdnCache ?. status ( ) ) . toBe ( 200 )
91107
@@ -110,7 +126,7 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
110126 const headers1 = response1 ?. headers ( ) || { }
111127 expect ( response1 ?. status ( ) ) . toBe ( 200 )
112128 expect ( headers1 [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
113- expect ( headers1 [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_${ pagePath } ` )
129+ expect ( headers1 [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_${ encodeURI ( pagePath ) . toLowerCase ( ) } ` )
114130 expect ( headers1 [ 'netlify-cdn-cache-control' ] ) . toBe (
115131 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
116132 )
@@ -138,7 +154,7 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
138154 const headers1Json = response1Json ?. headers ( ) || { }
139155 expect ( response1Json ?. status ( ) ) . toBe ( 200 )
140156 expect ( headers1Json [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
141- expect ( headers1Json [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_${ pagePath } ` )
157+ expect ( headers1Json [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_${ encodeURI ( pagePath ) . toLowerCase ( ) } ` )
142158 expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
143159 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
144160 )
@@ -459,14 +475,32 @@ test.describe('Page Router with basePath and i18n', () => {
459475 revalidateApiBasePath : '/api/revalidate-no-await' ,
460476 expectedH1Content : 'Product not-prerendered-and-not-awaited-revalidation' ,
461477 } ,
478+ {
479+ label :
480+ 'prerendered page with dynamic path and awaited res.revalidate() - non-ASCII variant' ,
481+ prerendered : true ,
482+ pagePath : '/products/事前レンダリング,test' ,
483+ revalidateApiBasePath : '/api/revalidate' ,
484+ expectedH1Content : 'Product 事前レンダリング,test' ,
485+ } ,
486+ {
487+ label :
488+ 'not prerendered page with dynamic path and awaited res.revalidate() - non-ASCII variant' ,
489+ prerendered : false ,
490+ pagePath : '/products/事前レンダリングされていない,test' ,
491+ revalidateApiBasePath : '/api/revalidate' ,
492+ expectedH1Content : 'Product 事前レンダリングされていない,test' ,
493+ } ,
462494 ] ) {
463495 test . describe ( label , ( ) => {
464496 test ( `default locale` , async ( { page, pollUntilHeadersMatch, pageRouterBasePathI18n } ) => {
465497 // in case there is retry or some other test did hit that path before
466498 // we want to make sure that cdn cache is not warmed up
467499 const purgeCdnCache = await page . goto (
468- new URL ( `/base/path/api/purge-cdn?path=/en${ pagePath } ` , pageRouterBasePathI18n . url )
469- . href ,
500+ new URL (
501+ `/base/path/api/purge-cdn?path=/en${ encodeURI ( pagePath ) } ` ,
502+ pageRouterBasePathI18n . url ,
503+ ) . href ,
470504 )
471505 expect ( purgeCdnCache ?. status ( ) ) . toBe ( 200 )
472506
@@ -494,7 +528,9 @@ test.describe('Page Router with basePath and i18n', () => {
494528 const headers1ImplicitLocale = response1ImplicitLocale ?. headers ( ) || { }
495529 expect ( response1ImplicitLocale ?. status ( ) ) . toBe ( 200 )
496530 expect ( headers1ImplicitLocale [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
497- expect ( headers1ImplicitLocale [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_/en${ pagePath } ` )
531+ expect ( headers1ImplicitLocale [ 'netlify-cache-tag' ] ) . toBe (
532+ `_n_t_/en${ encodeURI ( pagePath ) . toLowerCase ( ) } ` ,
533+ )
498534 expect ( headers1ImplicitLocale [ 'netlify-cdn-cache-control' ] ) . toBe (
499535 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
500536 )
@@ -520,7 +556,9 @@ test.describe('Page Router with basePath and i18n', () => {
520556 const headers1ExplicitLocale = response1ExplicitLocale ?. headers ( ) || { }
521557 expect ( response1ExplicitLocale ?. status ( ) ) . toBe ( 200 )
522558 expect ( headers1ExplicitLocale [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
523- expect ( headers1ExplicitLocale [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_/en${ pagePath } ` )
559+ expect ( headers1ExplicitLocale [ 'netlify-cache-tag' ] ) . toBe (
560+ `_n_t_/en${ encodeURI ( pagePath ) . toLowerCase ( ) } ` ,
561+ )
524562 expect ( headers1ExplicitLocale [ 'netlify-cdn-cache-control' ] ) . toBe (
525563 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
526564 )
@@ -552,7 +590,9 @@ test.describe('Page Router with basePath and i18n', () => {
552590 const headers1Json = response1Json ?. headers ( ) || { }
553591 expect ( response1Json ?. status ( ) ) . toBe ( 200 )
554592 expect ( headers1Json [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
555- expect ( headers1Json [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_/en${ pagePath } ` )
593+ expect ( headers1Json [ 'netlify-cache-tag' ] ) . toBe (
594+ `_n_t_/en${ encodeURI ( pagePath ) . toLowerCase ( ) } ` ,
595+ )
556596 expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
557597 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
558598 )
@@ -870,7 +910,7 @@ test.describe('Page Router with basePath and i18n', () => {
870910 const headers1 = response1 ?. headers ( ) || { }
871911 expect ( response1 ?. status ( ) ) . toBe ( 200 )
872912 expect ( headers1 [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
873- expect ( headers1 [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_/de${ pagePath } ` )
913+ expect ( headers1 [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_/de${ encodeURI ( pagePath ) . toLowerCase ( ) } ` )
874914 expect ( headers1 [ 'netlify-cdn-cache-control' ] ) . toBe (
875915 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
876916 )
@@ -899,7 +939,9 @@ test.describe('Page Router with basePath and i18n', () => {
899939 const headers1Json = response1Json ?. headers ( ) || { }
900940 expect ( response1Json ?. status ( ) ) . toBe ( 200 )
901941 expect ( headers1Json [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
902- expect ( headers1Json [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_/de${ pagePath } ` )
942+ expect ( headers1Json [ 'netlify-cache-tag' ] ) . toBe (
943+ `_n_t_/de${ encodeURI ( pagePath ) . toLowerCase ( ) } ` ,
944+ )
903945 expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
904946 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
905947 )
0 commit comments