@@ -95,6 +95,7 @@ export class StaticRouters {
9595 console . error ( error , errorInfo ) ;
9696 } ,
9797 noStreaming,
98+ headers,
9899 staticHeaders,
99100 staticProps,
100101 } : {
@@ -104,6 +105,7 @@ export class StaticRouters {
104105 context ?: T ;
105106 onError ?( error : unknown , errorInfo : React . ErrorInfo ) : string | void ;
106107 noStreaming ?: boolean ;
108+ headers ?: HeadersInit ;
107109 staticHeaders ?: HeadersInit ;
108110 staticProps ?: Record < string , unknown > ;
109111 }
@@ -135,13 +137,14 @@ export class StaticRouters {
135137 headers : {
136138 "Content-Type" : "application/vnd.server-side-props" ,
137139 "Cache-Control" : "no-store" ,
140+ ...headers ,
138141 } ,
139142 } ) ;
140143 }
141144 if ( result ?. redirect ) {
142145 return new Response ( null , {
143146 status : 302 ,
144- headers : { Location : result . redirect } ,
147+ headers : { Location : result . redirect , ... headers } ,
145148 } ) ;
146149 }
147150 const hashedBootstrapModules = bootstrapModules ?. map ( ( name ) => {
@@ -184,13 +187,15 @@ export class StaticRouters {
184187 headers : {
185188 "Content-Type" : "text/html; charset=utf-8" ,
186189 "Cache-Control" : "no-store" ,
190+ ...headers ,
187191 } ,
188192 } ) ;
189193 }
190194 return new Response ( stream , {
191195 headers : {
192196 "Content-Type" : "text/html; charset=utf-8" ,
193197 "Cache-Control" : "no-store" ,
198+ ...headers ,
194199 } ,
195200 } ) ;
196201 }
0 commit comments