@@ -31,7 +31,7 @@ function find(uri, extns) {
31
31
return data ;
32
32
}
33
33
34
- function is404 ( res ) {
34
+ function is404 ( req , res ) {
35
35
return ( res . statusCode = 404 , res . end ( ) ) ;
36
36
}
37
37
@@ -83,7 +83,7 @@ module.exports = function (dir, opts={}) {
83
83
let uri = decodeURIComponent ( req . path || req . pathname || parser ( req ) . pathname ) ;
84
84
let arr = uri . includes ( '.' ) ? [ uri ] : toAssume ( uri , extensions ) ;
85
85
let file = arr . map ( x => join ( dir , x ) ) . find ( fs . existsSync ) ;
86
- if ( ! file ) return next ? next ( ) : isNotFound ( res ) ;
86
+ if ( ! file ) return next ? next ( ) : isNotFound ( req , res ) ;
87
87
88
88
let stats = fs . statSync ( file ) ;
89
89
setHeaders ( res , uri , stats ) ;
@@ -118,7 +118,7 @@ module.exports = function (dir, opts={}) {
118
118
return function ( req , res , next ) {
119
119
let pathname = decodeURIComponent ( req . path || req . pathname || parser ( req ) . pathname ) ;
120
120
let data = find ( pathname , extensions ) ;
121
- if ( ! data ) return next ? next ( ) : isNotFound ( res ) ;
121
+ if ( ! data ) return next ? next ( ) : isNotFound ( req , res ) ;
122
122
123
123
setHeaders ( res , pathname , data . stats ) ;
124
124
send ( req , res , data . abs , data . stats , data . headers ) ;
0 commit comments