@@ -85,15 +85,15 @@ class RESPONSE {
85
85
return asArr
86
86
? this . _headers
87
87
: Object . keys ( this . _headers ) . reduce (
88
- ( headers , key ) =>
89
- Object . assign ( headers , { [ key ] : this . _headers [ key ] . toString ( ) } ) ,
90
- { }
91
- ) ; // return all headers
88
+ ( headers , key ) =>
89
+ Object . assign ( headers , { [ key ] : this . _headers [ key ] . toString ( ) } ) ,
90
+ { }
91
+ ) ; // return all headers
92
92
return asArr
93
93
? this . _headers [ key . toLowerCase ( ) ]
94
94
: this . _headers [ key . toLowerCase ( ) ]
95
- ? this . _headers [ key . toLowerCase ( ) ] . toString ( )
96
- : undefined ;
95
+ ? this . _headers [ key . toLowerCase ( ) ] . toString ( )
96
+ : undefined ;
97
97
}
98
98
99
99
// Issue #130
@@ -131,9 +131,9 @@ class RESPONSE {
131
131
132
132
this . header ( 'Content-Type' , 'application/json' ) . send (
133
133
( cb ? cb . replace ( ' ' , '_' ) : 'callback' ) +
134
- '(' +
135
- this . _serializer ( body ) +
136
- ')'
134
+ '(' +
135
+ this . _serializer ( body ) +
136
+ ')'
137
137
) ;
138
138
}
139
139
@@ -193,8 +193,8 @@ class RESPONSE {
193
193
typeof expires === 'function'
194
194
? expires
195
195
: typeof callback === 'function'
196
- ? callback
197
- : ( e ) => {
196
+ ? callback
197
+ : ( e ) => {
198
198
if ( e ) this . error ( e ) ;
199
199
} ;
200
200
@@ -236,10 +236,10 @@ class RESPONSE {
236
236
cookieString +=
237
237
opts . maxAge && ! isNaN ( opts . maxAge )
238
238
? '; MaxAge=' +
239
- ( ( opts . maxAge / 1000 ) | 0 ) +
240
- ( ! opts . expires
241
- ? '; Expires=' + new Date ( Date . now ( ) + opts . maxAge ) . toUTCString ( )
242
- : '' )
239
+ ( ( opts . maxAge / 1000 ) | 0 ) +
240
+ ( ! opts . expires
241
+ ? '; Expires=' + new Date ( Date . now ( ) + opts . maxAge ) . toUTCString ( )
242
+ : '' )
243
243
: '' ;
244
244
245
245
// path (String): Path for the cookie
@@ -253,9 +253,9 @@ class RESPONSE {
253
253
cookieString +=
254
254
opts . sameSite !== undefined
255
255
? '; SameSite=' +
256
- ( opts . sameSite === true
257
- ? 'Strict'
258
- : opts . sameSite === false
256
+ ( opts . sameSite === true
257
+ ? 'Strict'
258
+ : opts . sameSite === false
259
259
? 'Lax'
260
260
: opts . sameSite )
261
261
: '' ;
@@ -323,7 +323,7 @@ class RESPONSE {
323
323
let buffer , modified ;
324
324
325
325
let opts = typeof options === 'object' ? options : { } ;
326
- let fn = typeof callback === 'function' ? callback : ( ) => { } ;
326
+ let fn = typeof callback === 'function' ? callback : ( ) => { } ;
327
327
328
328
// Add optional parameter support
329
329
if ( typeof options === 'function' ) {
@@ -440,16 +440,16 @@ class RESPONSE {
440
440
opts . methods
441
441
? opts . methods
442
442
: acam
443
- ? acam
444
- : 'GET, PUT, POST, DELETE, OPTIONS'
443
+ ? acam
444
+ : 'GET, PUT, POST, DELETE, OPTIONS'
445
445
) ;
446
446
this . header (
447
447
'Access-Control-Allow-Headers' ,
448
448
opts . headers
449
449
? opts . headers
450
450
: acah
451
- ? acah
452
- : 'Content-Type, Authorization, Content-Length, X-Requested-With'
451
+ ? acah
452
+ : 'Content-Type, Authorization, Content-Length, X-Requested-With'
453
453
) ;
454
454
455
455
// Optional CORS headers
@@ -500,8 +500,8 @@ class RESPONSE {
500
500
date && typeof date . toUTCString === 'function'
501
501
? date
502
502
: date && Date . parse ( date )
503
- ? new Date ( date )
504
- : new Date ( ) ;
503
+ ? new Date ( date )
504
+ : new Date ( ) ;
505
505
this . header ( 'Last-Modified' , lastModified . toUTCString ( ) ) ;
506
506
}
507
507
return this ;
@@ -559,10 +559,10 @@ class RESPONSE {
559
559
} ,
560
560
this . _request . interface === 'alb'
561
561
? {
562
- statusDescription : `${ this . _statusCode } ${ UTILS . statusLookup (
563
- this . _statusCode
564
- ) } `,
565
- }
562
+ statusDescription : `${ this . _statusCode } ${ UTILS . statusLookup (
563
+ this . _statusCode
564
+ ) } `,
565
+ }
566
566
: { }
567
567
) ;
568
568
@@ -596,11 +596,13 @@ class RESPONSE {
596
596
error ( code , e , detail ) {
597
597
const message = typeof code !== 'number' ? code : e ;
598
598
const statusCode = typeof code === 'number' ? code : undefined ;
599
- const errorDetail = typeof code !== 'number' && e !== undefined ? e : detail ;
599
+ const errorDetail =
600
+ typeof code !== 'number' && e !== undefined ? e : detail ;
600
601
601
- const errorToSend = typeof message === 'string'
602
- ? new ApiError ( message , statusCode , errorDetail )
603
- : message ;
602
+ const errorToSend =
603
+ typeof message === 'string'
604
+ ? new ApiError ( message , statusCode , errorDetail )
605
+ : message ;
604
606
605
607
this . app . catchErrors ( errorToSend , this , statusCode , errorDetail ) ;
606
608
} // end error
0 commit comments