File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
packages/next/src/server/lib/server-ipc
test/e2e/middleware-general/test Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const INTERNAL_HEADERS = [
45
45
'x-middleware-set-cookie' ,
46
46
'x-middleware-skip' ,
47
47
'x-middleware-override-headers' ,
48
+ 'x-middleware-subrequest' ,
48
49
'x-middleware-next' ,
49
50
'x-now-route-matches' ,
50
51
'x-matched-path' ,
Original file line number Diff line number Diff line change @@ -144,6 +144,19 @@ describe('Middleware Runtime', () => {
144
144
}
145
145
}
146
146
147
+ it ( 'should filter request header properly' , async ( ) => {
148
+ const res = await next . fetch ( '/redirect-to-somewhere' , {
149
+ headers : {
150
+ 'x-middleware-subrequest' :
151
+ 'middleware:middleware:middleware:middleware:middleware' ,
152
+ } ,
153
+ redirect : 'manual' ,
154
+ } )
155
+
156
+ expect ( res . status ) . toBe ( 307 )
157
+ expect ( res . headers . get ( 'location' ) ) . toContain ( '/somewhere' )
158
+ } )
159
+
147
160
it ( 'should handle 404 on fallback: false route correctly' , async ( ) => {
148
161
const res = await next . fetch ( '/ssg-fallback-false/first' )
149
162
expect ( res . status ) . toBe ( 200 )
You can’t perform that action at this time.
0 commit comments