serve-index
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -0,1 +1,22 @@ | ||
1.9.0 / 2017-05-25 | ||
================== | ||
* Set `X-Content-Type-Options: nosniff` header | ||
* deps: batch@0.6.1 | ||
* deps: debug@2.6.8 | ||
- Allow colors in workers | ||
- Deprecated `DEBUG_FD` environment variable set to `3` or higher | ||
- Fix `DEBUG_MAX_ARRAY_LENGTH` | ||
- Fix error when running under React Native | ||
- Use same color for same namespace | ||
- deps: ms@2.0.0 | ||
* deps: http-errors@~1.6.1 | ||
- Make `message` property enumerable for `HttpError`s | ||
- deps: inherits@2.0.3 | ||
- deps: setprototypeof@1.0.3 | ||
- deps: statuses@'>= 1.3.1 < 2' | ||
* deps: mime-types@~2.1.15 | ||
- Add new mime types | ||
- Add `audio/mp3` | ||
1.8.0 / 2016-06-17 | ||
@@ -2,0 +23,0 @@ ================== |
39
index.js
@@ -211,7 +211,3 @@ /*! | ||
if (err) return next(err); | ||
var buf = new Buffer(body, 'utf8'); | ||
res.setHeader('Content-Type', 'text/html; charset=utf-8'); | ||
res.setHeader('Content-Length', buf.length); | ||
res.end(buf); | ||
send(res, 'text/html', body) | ||
}); | ||
@@ -227,8 +223,3 @@ }); | ||
serveIndex.json = function _json(req, res, files) { | ||
var body = JSON.stringify(files); | ||
var buf = new Buffer(body, 'utf8'); | ||
res.setHeader('Content-Type', 'application/json; charset=utf-8'); | ||
res.setHeader('Content-Length', buf.length); | ||
res.end(buf); | ||
send(res, 'application/json', JSON.stringify(files)) | ||
}; | ||
@@ -241,8 +232,3 @@ | ||
serveIndex.plain = function _plain(req, res, files) { | ||
var body = files.join('\n') + '\n'; | ||
var buf = new Buffer(body, 'utf8'); | ||
res.setHeader('Content-Type', 'text/plain; charset=utf-8'); | ||
res.setHeader('Content-Length', buf.length); | ||
res.end(buf); | ||
send(res, 'text/plain', (files.join('\n') + '\n')) | ||
}; | ||
@@ -431,5 +417,3 @@ | ||
if (!useIcons) return ''; | ||
var className; | ||
var i; | ||
var iconName; | ||
var list = []; | ||
@@ -513,2 +497,19 @@ var rules = {}; | ||
/** | ||
* Send a response. | ||
* @private | ||
*/ | ||
function send (res, type, body) { | ||
// security header for content sniffing | ||
res.setHeader('X-Content-Type-Options', 'nosniff') | ||
// standard headers | ||
res.setHeader('Content-Type', type + '; charset=utf-8') | ||
res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8')) | ||
// body | ||
res.end(body, 'utf8') | ||
} | ||
/** | ||
* Stat all files and return array of stat | ||
@@ -515,0 +516,0 @@ * in same order. |
{ | ||
"name": "serve-index", | ||
"description": "Serve directory listings", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
@@ -10,12 +10,12 @@ "license": "MIT", | ||
"accepts": "~1.3.3", | ||
"batch": "0.5.3", | ||
"debug": "~2.2.0", | ||
"batch": "0.6.1", | ||
"debug": "2.6.8", | ||
"escape-html": "~1.0.3", | ||
"http-errors": "~1.5.0", | ||
"mime-types": "~2.1.11", | ||
"http-errors": "~1.6.1", | ||
"mime-types": "~2.1.15", | ||
"parseurl": "~1.3.1" | ||
}, | ||
"devDependencies": { | ||
"after": "0.8.1", | ||
"istanbul": "0.4.3", | ||
"after": "0.8.2", | ||
"istanbul": "0.4.5", | ||
"mocha": "2.5.3", | ||
@@ -22,0 +22,0 @@ "supertest": "1.1.0" |
@@ -14,2 +14,6 @@ # serve-index | ||
This is a [Node.js](https://nodejs.org/en/) module available through the | ||
[npm registry](https://www.npmjs.com/). Installation is done using the | ||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): | ||
```sh | ||
@@ -16,0 +20,0 @@ $ npm install serve-index |
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
92924
151
+ Addedbatch@0.6.1(transitive)
+ Addeddebug@2.6.8(transitive)
+ Addeddepd@1.1.2(transitive)
+ Addedhttp-errors@1.6.3(transitive)
+ Addedms@2.0.0(transitive)
+ Addedsetprototypeof@1.1.0(transitive)
- Removedbatch@0.5.3(transitive)
- Removeddebug@2.2.0(transitive)
- Removedhttp-errors@1.5.1(transitive)
- Removedms@0.7.1(transitive)
- Removedsetprototypeof@1.0.2(transitive)
Updatedbatch@0.6.1
Updateddebug@2.6.8
Updatedhttp-errors@~1.6.1
Updatedmime-types@~2.1.15