@@ -95,6 +95,7 @@ export class StaticRouters {
95
95
console . error ( error , errorInfo ) ;
96
96
} ,
97
97
noStreaming,
98
+ headers,
98
99
staticHeaders,
99
100
staticProps,
100
101
} : {
@@ -104,6 +105,7 @@ export class StaticRouters {
104
105
context ?: T ;
105
106
onError ?( error : unknown , errorInfo : React . ErrorInfo ) : string | void ;
106
107
noStreaming ?: boolean ;
108
+ headers ?: HeadersInit ;
107
109
staticHeaders ?: HeadersInit ;
108
110
staticProps ?: Record < string , unknown > ;
109
111
}
@@ -135,13 +137,14 @@ export class StaticRouters {
135
137
headers : {
136
138
"Content-Type" : "application/vnd.server-side-props" ,
137
139
"Cache-Control" : "no-store" ,
140
+ ...headers ,
138
141
} ,
139
142
} ) ;
140
143
}
141
144
if ( result ?. redirect ) {
142
145
return new Response ( null , {
143
146
status : 302 ,
144
- headers : { Location : result . redirect } ,
147
+ headers : { Location : result . redirect , ... headers } ,
145
148
} ) ;
146
149
}
147
150
const hashedBootstrapModules = bootstrapModules ?. map ( ( name ) => {
@@ -184,13 +187,15 @@ export class StaticRouters {
184
187
headers : {
185
188
"Content-Type" : "text/html; charset=utf-8" ,
186
189
"Cache-Control" : "no-store" ,
190
+ ...headers ,
187
191
} ,
188
192
} ) ;
189
193
}
190
194
return new Response ( stream , {
191
195
headers : {
192
196
"Content-Type" : "text/html; charset=utf-8" ,
193
197
"Cache-Control" : "no-store" ,
198
+ ...headers ,
194
199
} ,
195
200
} ) ;
196
201
}
0 commit comments