@@ -35,6 +35,21 @@ describe('skip-trailing-slash-redirect', () => {
3535 }
3636 } )
3737
38+ it ( 'should provide original _next/data URL with skipMiddlewareUrlNormalize' , async ( ) => {
39+ const res = await fetchViaHTTP (
40+ next . url ,
41+ `/_next/data/${ next . buildId } /valid.json` ,
42+ undefined ,
43+ {
44+ headers : {
45+ 'x-nextjs-data' : '1' ,
46+ } ,
47+ }
48+ )
49+ expect ( res . status ) . toBe ( 200 )
50+ expect ( await res . text ( ) ) . toContain ( 'Example Domain' )
51+ } )
52+
3853 it ( 'should allow response body from middleware with flag' , async ( ) => {
3954 const res = await fetchViaHTTP ( next . url , '/middleware-response-body' )
4055 expect ( res . status ) . toBe ( 200 )
@@ -88,15 +103,15 @@ describe('skip-trailing-slash-redirect', () => {
88103 it ( 'should correct skip URL normalizing in middleware' , async ( ) => {
89104 let res = await fetchViaHTTP (
90105 next . url ,
91- '/ middleware-rewrite-with-slash' ,
106+ `/_next/data/ ${ next . buildId } / middleware-rewrite-with-slash.json` ,
92107 undefined ,
93108 { redirect : 'manual' , headers : { 'x-nextjs-data' : '1' } }
94109 )
95110 expect ( res . headers . get ( 'x-nextjs-rewrite' ) . endsWith ( '/another/' ) ) . toBe ( true )
96111
97112 res = await fetchViaHTTP (
98113 next . url ,
99- '/ middleware-rewrite-without-slash' ,
114+ `/_next/data/ ${ next . buildId } / middleware-rewrite-without-slash.json` ,
100115 undefined ,
101116 { redirect : 'manual' , headers : { 'x-nextjs-data' : '1' } }
102117 )
0 commit comments