@@ -119,14 +119,18 @@ export async function handleServerFunction(h3Event: H3Event) {
119119 // forward headers
120120 if ( ( x as any ) . headers ) mergeResponseHeaders ( h3Event , ( x as any ) . headers ) ;
121121 // forward non-redirect statuses
122- if ( ( x as any ) . status && ( ! instance || ( x as any ) . status < 300 || ( x as any ) . status >= 400 ) )
122+ if (
123+ ( x as any ) . status &&
124+ ( ! instance || ( x as any ) . status < 300 || ( x as any ) . status >= 400 )
125+ )
123126 h3Event . res . status = ( x as any ) . status ;
124127 if ( ( x as any ) . customBody ) {
125128 x = await ( x as any ) . customBody ( ) ;
126129 } else if ( ( x as any ) . body == null ) x = null ;
127130 h3Event . res . headers . set ( "X-Error" , "true" ) ;
128131 } else if ( instance ) {
129- const error = x instanceof Error ? x . message : typeof x === "string" ? x : "true" ;
132+ const error =
133+ x instanceof Error ? x . message : typeof x === "string" ? x : "true" ;
130134
131135 h3Event . res . headers . set ( "X-Error" , error . replace ( / [ \r \n ] + / g, "" ) ) ;
132136 } else {
@@ -156,7 +160,12 @@ export async function handleServerFunction(h3Event: H3Event) {
156160 }
157161}
158162
159- function handleNoJS ( result : any , request : Request , parsed : any [ ] , thrown ?: boolean ) {
163+ function handleNoJS (
164+ result : any ,
165+ request : Request ,
166+ parsed : any [ ] ,
167+ thrown ?: boolean ,
168+ ) {
160169 const url = new URL ( request . url ) ;
161170 const isError = result instanceof Error ;
162171 let statusCode = 302 ;
@@ -166,7 +175,10 @@ function handleNoJS(result: any, request: Request, parsed: any[], thrown?: boole
166175 if ( result . headers . has ( "Location" ) ) {
167176 headers . set (
168177 `Location` ,
169- new URL ( result . headers . get ( "Location" ) ! , url . origin + import . meta. env . BASE_URL ) . toString ( ) ,
178+ new URL (
179+ result . headers . get ( "Location" ) ! ,
180+ url . origin + import . meta. env . BASE_URL ,
181+ ) . toString ( ) ,
170182 ) ;
171183 statusCode = getExpectedRedirectStatus ( result ) ;
172184 }
@@ -183,7 +195,10 @@ function handleNoJS(result: any, request: Request, parsed: any[], thrown?: boole
183195 result : isError ? result . message : result ,
184196 thrown : thrown ,
185197 error : isError ,
186- input : [ ...parsed . slice ( 0 , - 1 ) , [ ...parsed [ parsed . length - 1 ] . entries ( ) ] ] ,
198+ input : [
199+ ...parsed . slice ( 0 , - 1 ) ,
200+ [ ...parsed [ parsed . length - 1 ] . entries ( ) ] ,
201+ ] ,
187202 } ) ,
188203 ) } ; Secure; HttpOnly;`,
189204 ) ;
@@ -209,7 +224,7 @@ function createSingleFlightHeaders(sourceEvent: FetchEvent) {
209224 // useH3Internals = true;
210225 // sourceEvent.nativeEvent.node.req.headers.cookie = "";
211226 // }
212- SetCookies . forEach ( cookie => {
227+ SetCookies . forEach ( ( cookie ) => {
213228 if ( ! cookie ) return ;
214229 const { maxAge, expires, name, value } = parseSetCookie ( cookie ) ;
215230 if ( maxAge != null && maxAge <= 0 ) {
@@ -230,7 +245,10 @@ function createSingleFlightHeaders(sourceEvent: FetchEvent) {
230245
231246 return headers ;
232247}
233- async function handleSingleFlight ( sourceEvent : FetchEvent , result : any ) : Promise < Response > {
248+ async function handleSingleFlight (
249+ sourceEvent : FetchEvent ,
250+ result : any ,
251+ ) : Promise < Response > {
234252 let revalidate : string [ ] ;
235253 let url = new URL ( sourceEvent . request . headers . get ( "referer" ) ! ) . toString ( ) ;
236254 if ( result instanceof Response ) {
0 commit comments