@@ -80,12 +80,28 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
80
80
revalidateApiBasePath : '/api/revalidate-no-await' ,
81
81
expectedH1Content : 'Product not-prerendered-and-not-awaited-revalidation' ,
82
82
} ,
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
+ } ,
83
99
] ) {
84
100
test ( label , async ( { page, pollUntilHeadersMatch, pageRouter } ) => {
85
101
// in case there is retry or some other test did hit that path before
86
102
// we want to make sure that cdn cache is not warmed up
87
103
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 ,
89
105
)
90
106
expect ( purgeCdnCache ?. status ( ) ) . toBe ( 200 )
91
107
@@ -110,7 +126,7 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
110
126
const headers1 = response1 ?. headers ( ) || { }
111
127
expect ( response1 ?. status ( ) ) . toBe ( 200 )
112
128
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 ( ) } ` )
114
130
expect ( headers1 [ 'netlify-cdn-cache-control' ] ) . toBe (
115
131
's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
116
132
)
@@ -138,7 +154,7 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
138
154
const headers1Json = response1Json ?. headers ( ) || { }
139
155
expect ( response1Json ?. status ( ) ) . toBe ( 200 )
140
156
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 ( ) } ` )
142
158
expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
143
159
's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
144
160
)
@@ -459,14 +475,32 @@ test.describe('Page Router with basePath and i18n', () => {
459
475
revalidateApiBasePath : '/api/revalidate-no-await' ,
460
476
expectedH1Content : 'Product not-prerendered-and-not-awaited-revalidation' ,
461
477
} ,
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
+ } ,
462
494
] ) {
463
495
test . describe ( label , ( ) => {
464
496
test ( `default locale` , async ( { page, pollUntilHeadersMatch, pageRouterBasePathI18n } ) => {
465
497
// in case there is retry or some other test did hit that path before
466
498
// we want to make sure that cdn cache is not warmed up
467
499
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 ,
470
504
)
471
505
expect ( purgeCdnCache ?. status ( ) ) . toBe ( 200 )
472
506
@@ -494,7 +528,9 @@ test.describe('Page Router with basePath and i18n', () => {
494
528
const headers1ImplicitLocale = response1ImplicitLocale ?. headers ( ) || { }
495
529
expect ( response1ImplicitLocale ?. status ( ) ) . toBe ( 200 )
496
530
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
+ )
498
534
expect ( headers1ImplicitLocale [ 'netlify-cdn-cache-control' ] ) . toBe (
499
535
's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
500
536
)
@@ -520,7 +556,9 @@ test.describe('Page Router with basePath and i18n', () => {
520
556
const headers1ExplicitLocale = response1ExplicitLocale ?. headers ( ) || { }
521
557
expect ( response1ExplicitLocale ?. status ( ) ) . toBe ( 200 )
522
558
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
+ )
524
562
expect ( headers1ExplicitLocale [ 'netlify-cdn-cache-control' ] ) . toBe (
525
563
's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
526
564
)
@@ -552,7 +590,9 @@ test.describe('Page Router with basePath and i18n', () => {
552
590
const headers1Json = response1Json ?. headers ( ) || { }
553
591
expect ( response1Json ?. status ( ) ) . toBe ( 200 )
554
592
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
+ )
556
596
expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
557
597
's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
558
598
)
@@ -870,7 +910,7 @@ test.describe('Page Router with basePath and i18n', () => {
870
910
const headers1 = response1 ?. headers ( ) || { }
871
911
expect ( response1 ?. status ( ) ) . toBe ( 200 )
872
912
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 ( ) } ` )
874
914
expect ( headers1 [ 'netlify-cdn-cache-control' ] ) . toBe (
875
915
's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
876
916
)
@@ -899,7 +939,9 @@ test.describe('Page Router with basePath and i18n', () => {
899
939
const headers1Json = response1Json ?. headers ( ) || { }
900
940
expect ( response1Json ?. status ( ) ) . toBe ( 200 )
901
941
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
+ )
903
945
expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
904
946
's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
905
947
)
0 commit comments