@@ -25,9 +25,8 @@ function toAssume(uri, extns) {
25
25
function find ( uri , extns ) {
26
26
let i = 0 , data , arr = toAssume ( uri , extns ) ;
27
27
for ( ; i < arr . length ; i ++ ) {
28
- if ( data = FILES [ arr [ i ] ] ) break ;
28
+ if ( data = FILES [ arr [ i ] ] ) return data ;
29
29
}
30
- return data ;
31
30
}
32
31
33
32
function is404 ( req , res ) {
@@ -84,15 +83,15 @@ module.exports = function (dir, opts={}) {
84
83
while ( file = arr . shift ( ) ) {
85
84
stats = fs . statSync ( file ) ;
86
85
if ( stats . isDirectory ( ) ) continue ;
87
- setHeaders ( res , uri , stats ) ;
88
- send ( req , res , file , stats , {
89
- 'Content-Type' : mime . getType ( file ) ,
90
- 'Last-Modified' : stats . mtime . toUTCString ( ) ,
91
- 'Content-Length' : stats . size ,
92
- } ) ;
86
+ setHeaders ( res , uri , stats ) ;
87
+ send ( req , res , file , stats , {
88
+ 'Content-Type' : mime . getType ( file ) ,
89
+ 'Last-Modified' : stats . mtime . toUTCString ( ) ,
90
+ 'Content-Length' : stats . size ,
91
+ } ) ;
92
+ }
93
93
}
94
94
}
95
- }
96
95
97
96
let cc = opts . maxAge != null && `public,max-age=${ opts . maxAge } ` ;
98
97
if ( cc && opts . immutable ) cc += ',immutable' ;
0 commit comments