serve-static
Advanced tools
Comparing version 1.5.3 to 1.5.4
31
index.js
@@ -27,5 +27,6 @@ /*! | ||
exports = module.exports = function(root, options){ | ||
// root required | ||
if (!root) throw new TypeError('root path required'); | ||
exports = module.exports = function serveStatic(root, options) { | ||
if (!root) { | ||
throw new TypeError('root path required') | ||
} | ||
@@ -36,6 +37,6 @@ // copy options object | ||
// resolve root to absolute | ||
root = resolve(root); | ||
root = resolve(root) | ||
// default redirect | ||
var redirect = false !== options.redirect; | ||
var redirect = options.redirect !== false | ||
@@ -51,11 +52,13 @@ // headers listener | ||
// setup options for send | ||
options.maxage = options.maxage || options.maxAge || 0; | ||
options.root = root; | ||
options.maxage = options.maxage || options.maxAge || 0 | ||
options.root = root | ||
return function staticMiddleware(req, res, next) { | ||
if ('GET' != req.method && 'HEAD' != req.method) return next(); | ||
return function serveStatic(req, res, next) { | ||
if (req.method !== 'GET' && req.method !== 'HEAD') { | ||
return next() | ||
} | ||
var opts = merge({}, options) | ||
var originalUrl = parseurl.original(req); | ||
var path = parseurl(req).pathname; | ||
var originalUrl = parseurl.original(req) | ||
var path = parseurl(req).pathname | ||
@@ -99,4 +102,4 @@ if (path === '/' && originalUrl.pathname[originalUrl.pathname.length - 1] !== '/') { | ||
stream.pipe(res) | ||
}; | ||
}; | ||
} | ||
} | ||
@@ -110,2 +113,2 @@ /** | ||
exports.mime = send.mime; | ||
exports.mime = send.mime |
{ | ||
"name": "serve-static", | ||
"description": "Serve static files", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
@@ -11,7 +11,7 @@ "license": "MIT", | ||
"parseurl": "~1.3.0", | ||
"send": "0.8.3", | ||
"send": "0.8.5", | ||
"utils-merge": "1.0.0" | ||
}, | ||
"devDependencies": { | ||
"istanbul": "0.3.0", | ||
"istanbul": "0.3.2", | ||
"mocha": "~1.21.0", | ||
@@ -21,2 +21,7 @@ "should": "~4.0.0", | ||
}, | ||
"files": [ | ||
"LICENSE", | ||
"HISTORY.md", | ||
"index.js" | ||
], | ||
"engines": { | ||
@@ -23,0 +28,0 @@ "node": ">= 0.8.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87
11646
5
145
+ Addedsend@0.8.5(transitive)
- Removedsend@0.8.3(transitive)
Updatedsend@0.8.5