@@ -272,7 +272,7 @@ const app = new Elysia()
272272 } ,
273273 credentials : true ,
274274 methods : [ 'GET' , 'HEAD' , 'PUT' , 'PATCH' , 'POST' , 'DELETE' , 'OPTIONS' ] ,
275- allowedHeaders : [ 'Content-Type' , 'Authorization' , 'X-Requested-With' , 'Accept' , 'Origin' ] ,
275+ allowedHeaders : [ 'Content-Type' , 'Authorization' , 'X-Requested-With' , 'Accept' , 'Origin' , 'x-sftp-password' , 'x-path' ] ,
276276 exposeHeaders : [ 'Content-Type' , 'Content-Length' , 'Cache-Control' ] ,
277277 } ) )
278278 . use ( helmet ( ) )
@@ -295,9 +295,9 @@ app.onError((ctx: any) => {
295295 status = ctx . code ;
296296 }
297297
298- if ( status === 404 ) {
298+ if ( status === 404 ) {
299299 const origin = ( ctx . request as Request ) ?. headers ?. get ?.( 'origin' ) || '*' ;
300- return new Response ( JSON . stringify ( { error : 'Route not found' } ) , { status : 404 , headers : { 'Content-Type' : 'application/json' , 'Access-Control-Allow-Origin' : origin , 'Access-Control-Allow-Credentials' : 'true' , 'Access-Control-Allow-Headers' : 'Content-Type, Authorization, X-Requested-With, Accept, Origin' , 'Access-Control-Expose-Headers' : 'Content-Type, Content-Length, Cache-Control' } } ) ;
300+ return new Response ( JSON . stringify ( { error : 'Route not found' } ) , { status : 404 , headers : { 'Content-Type' : 'application/json' , 'Access-Control-Allow-Origin' : origin , 'Access-Control-Allow-Credentials' : 'true' , 'Access-Control-Allow-Headers' : 'Content-Type, Authorization, X-Requested-With, Accept, Origin, x-sftp-password, x-path ' , 'Access-Control-Expose-Headers' : 'Content-Type, Content-Length, Cache-Control' } } ) ;
301301 }
302302
303303 const log = ( app as any ) . log || console ;
@@ -324,11 +324,11 @@ app.onError((ctx: any) => {
324324 }
325325
326326 const origin = ( ctx . request as Request ) ?. headers ?. get ?.( 'origin' ) || '*' ;
327- return new Response ( JSON . stringify ( { error : 'Internal server error' } ) , { status : 500 , headers : { 'Content-Type' : 'application/json' , 'Access-Control-Allow-Origin' : origin , 'Access-Control-Allow-Credentials' : 'true' , 'Access-Control-Allow-Headers' : 'Content-Type, Authorization, X-Requested-With, Accept, Origin' , 'Access-Control-Expose-Headers' : 'Content-Type, Content-Length, Cache-Control' } } ) ;
327+ return new Response ( JSON . stringify ( { error : 'Internal server error' } ) , { status : 500 , headers : { 'Content-Type' : 'application/json' , 'Access-Control-Allow-Origin' : origin , 'Access-Control-Allow-Credentials' : 'true' , 'Access-Control-Allow-Headers' : 'Content-Type, Authorization, X-Requested-With, Accept, Origin, x-sftp-password, x-path ' , 'Access-Control-Expose-Headers' : 'Content-Type, Content-Length, Cache-Control' } } ) ;
328328 }
329329
330330 const origin = ( ctx . request as Request ) ?. headers ?. get ?.( 'origin' ) || '*' ;
331- return new Response ( JSON . stringify ( { error : ctx . error ?. message ?? 'Request error' } ) , { status, headers : { 'Content-Type' : 'application/json' , 'Access-Control-Allow-Origin' : origin , 'Access-Control-Allow-Credentials' : 'true' , 'Access-Control-Allow-Headers' : 'Content-Type, Authorization, X-Requested-With, Accept, Origin' , 'Access-Control-Expose-Headers' : 'Content-Type, Content-Length, Cache-Control' } } ) ;
331+ return new Response ( JSON . stringify ( { error : ctx . error ?. message ?? 'Request error' } ) , { status, headers : { 'Content-Type' : 'application/json' , 'Access-Control-Allow-Origin' : origin , 'Access-Control-Allow-Credentials' : 'true' , 'Access-Control-Allow-Headers' : 'Content-Type, Authorization, X-Requested-With, Accept, Origin, x-sftp-password, x-path ' , 'Access-Control-Expose-Headers' : 'Content-Type, Content-Length, Cache-Control' } } ) ;
332332} ) ;
333333
334334declare module 'elysia' {
0 commit comments