@@ -121,14 +121,18 @@ export async function handleServerFunction(h3Event: H3Event) {
121121 // forward headers
122122 if ( ( x as any ) . headers ) mergeResponseHeaders ( h3Event , ( x as any ) . headers ) ;
123123 // forward non-redirect statuses
124- if ( ( x as any ) . status && ( ! instance || ( x as any ) . status < 300 || ( x as any ) . status >= 400 ) )
124+ if (
125+ ( x as any ) . status &&
126+ ( ! instance || ( x as any ) . status < 300 || ( x as any ) . status >= 400 )
127+ )
125128 h3Event . res . status = ( x as any ) . status ;
126129 if ( ( x as any ) . customBody ) {
127130 x = await ( x as any ) . customBody ( ) ;
128131 } else if ( ( x as any ) . body == null ) x = null ;
129132 h3Event . res . headers . set ( "X-Error" , "true" ) ;
130133 } else if ( instance ) {
131- const error = x instanceof Error ? x . message : typeof x === "string" ? x : "true" ;
134+ const error =
135+ x instanceof Error ? x . message : typeof x === "string" ? x : "true" ;
132136
133137 h3Event . res . headers . set ( "X-Error" , error . replace ( / [ \r \n ] + / g, "" ) ) ;
134138 } else {
@@ -158,7 +162,12 @@ export async function handleServerFunction(h3Event: H3Event) {
158162 }
159163}
160164
161- function handleNoJS ( result : any , request : Request , parsed : any [ ] , thrown ?: boolean ) {
165+ function handleNoJS (
166+ result : any ,
167+ request : Request ,
168+ parsed : any [ ] ,
169+ thrown ?: boolean ,
170+ ) {
162171 const url = new URL ( request . url ) ;
163172 const isError = result instanceof Error ;
164173 let statusCode = 302 ;
@@ -168,7 +177,10 @@ function handleNoJS(result: any, request: Request, parsed: any[], thrown?: boole
168177 if ( result . headers . has ( "Location" ) ) {
169178 headers . set (
170179 `Location` ,
171- new URL ( result . headers . get ( "Location" ) ! , url . origin + import . meta. env . BASE_URL ) . toString ( ) ,
180+ new URL (
181+ result . headers . get ( "Location" ) ! ,
182+ url . origin + import . meta. env . BASE_URL ,
183+ ) . toString ( ) ,
172184 ) ;
173185 statusCode = getExpectedRedirectStatus ( result ) ;
174186 }
@@ -185,7 +197,10 @@ function handleNoJS(result: any, request: Request, parsed: any[], thrown?: boole
185197 result : isError ? result . message : result ,
186198 thrown : thrown ,
187199 error : isError ,
188- input : [ ...parsed . slice ( 0 , - 1 ) , [ ...parsed [ parsed . length - 1 ] . entries ( ) ] ] ,
200+ input : [
201+ ...parsed . slice ( 0 , - 1 ) ,
202+ [ ...parsed [ parsed . length - 1 ] . entries ( ) ] ,
203+ ] ,
189204 } ) ,
190205 ) } ; Secure; HttpOnly;`,
191206 ) ;
@@ -211,7 +226,7 @@ export function createSingleFlightHeaders(sourceEvent: FetchEvent) {
211226 // useH3Internals = true;
212227 // sourceEvent.nativeEvent.node.req.headers.cookie = "";
213228 // }
214- SetCookies . forEach ( cookie => {
229+ SetCookies . forEach ( ( cookie ) => {
215230 if ( ! cookie ) return ;
216231 const { maxAge, expires, name, value } = parseSetCookie ( cookie ) ;
217232 if ( maxAge != null && maxAge <= 0 ) {
@@ -232,7 +247,10 @@ export function createSingleFlightHeaders(sourceEvent: FetchEvent) {
232247
233248 return headers ;
234249}
235- async function handleSingleFlight ( sourceEvent : FetchEvent , result : any ) : Promise < Response > {
250+ async function handleSingleFlight (
251+ sourceEvent : FetchEvent ,
252+ result : any ,
253+ ) : Promise < Response > {
236254 let revalidate : string [ ] ;
237255 let url = new URL ( sourceEvent . request . headers . get ( "referer" ) ! ) . toString ( ) ;
238256 if ( result instanceof Response ) {
0 commit comments