@@ -28,16 +28,19 @@ module.exports = {
2828 next ( ) ;
2929 } ,
3030
31- cache_for ( res , duration = ( 365 * 24 * 60 * 60 ) ) {
31+ cache_for ( res , duration = 365 * 24 * 60 * 60 ) {
3232 res . cache_for = duration ;
33- const exp = new Date ( Date . now ( ) + ( duration * 1000 ) ) ;
33+ const exp = new Date ( Date . now ( ) + duration * 1000 ) ;
3434 res . setHeader ( 'Cache-Control' , `public, max-age=${ duration } ` ) ;
3535 res . setHeader ( 'Expires' , exp . toGMTString ( ) ) ;
3636 } ,
3737
3838 log_request ( req , res , _head , next ) {
3939 const td = Date . now ( ) - req . start_date ;
40- this . options . log ( 'info' , `${ req . method } ${ req . url } ${ td } ms ${ res . finished ? res . statusCode : '(unfinished)' } ` ) ;
40+ this . options . log (
41+ 'info' ,
42+ `${ req . method } ${ req . url } ${ td } ms ${ res . finished ? res . statusCode : '(unfinished)' } `
43+ ) ;
4144 next ( ) ;
4245 } ,
4346
@@ -48,16 +51,16 @@ module.exports = {
4851 }
4952
5053 switch ( ( req . headers [ 'content-type' ] || '' ) . split ( ';' ) [ 0 ] ) {
51- case 'application/x-www-form-urlencoded' :
52- req . body = querystring . parse ( body ) ;
53- break ;
54- case 'text/plain' :
55- case '' :
56- req . body = body ;
57- break ;
58- default :
59- this . options . log ( 'error' , `Unsupported content-type ${ req . headers [ 'content-type' ] } ` ) ;
60- break ;
54+ case 'application/x-www-form-urlencoded' :
55+ req . body = querystring . parse ( body ) ;
56+ break ;
57+ case 'text/plain' :
58+ case '' :
59+ req . body = body ;
60+ break ;
61+ default :
62+ this . options . log ( 'error' , `Unsupported content-type ${ req . headers [ 'content-type' ] } ` ) ;
63+ break ;
6164 }
6265 next ( ) ;
6366 } ) ;
@@ -70,17 +73,17 @@ module.exports = {
7073 }
7174
7275 switch ( ( req . headers [ 'content-type' ] || '' ) . split ( ';' ) [ 0 ] ) {
73- case 'text/plain' :
74- case 'T' :
75- case 'application/json' :
76- case 'application/xml' :
77- case '' :
78- case 'text/xml' :
79- req . body = body ;
80- break ;
81- default :
82- this . options . log ( 'error' , `Unsupported content-type ${ req . headers [ 'content-type' ] } ` ) ;
83- break ;
76+ case 'text/plain' :
77+ case 'T' :
78+ case 'application/json' :
79+ case 'application/xml' :
80+ case '' :
81+ case 'text/xml' :
82+ req . body = body ;
83+ break ;
84+ default :
85+ this . options . log ( 'error' , `Unsupported content-type ${ req . headers [ 'content-type' ] } ` ) ;
86+ break ;
8487 }
8588 next ( ) ;
8689 } ) ;
@@ -97,7 +100,7 @@ module.exports = {
97100 } ,
98101
99102 xhr_options ( req , res , _head , next ) {
100- res . statusCode = 204 ; // No content
103+ res . statusCode = 204 ; // No content
101104 module . exports . cache_for ( res ) ;
102105 res . setHeader ( 'Access-Control-Allow-Methods' , 'OPTIONS, POST' ) ;
103106 res . setHeader ( 'Access-Control-Max-Age' , res . cache_for ) ;
@@ -124,5 +127,5 @@ module.exports = {
124127 res . setHeader ( 'Access-Control-Allow-Headers' , headers ) ;
125128 }
126129 next ( ) ;
127- } ,
130+ }
128131} ;
0 commit comments