finalhandler
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -0,1 +1,7 @@ | ||
0.3.0 / 2014-09-17 | ||
================== | ||
* Terminate in progress response only on error | ||
* Use `on-finished` to determine request status | ||
0.2.0 / 2014-09-03 | ||
@@ -2,0 +8,0 @@ ================== |
12
index.js
@@ -14,2 +14,3 @@ /*! | ||
var http = require('http') | ||
var onFinished = require('on-finished') | ||
@@ -24,2 +25,3 @@ /** | ||
: function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } | ||
var isFinished = onFinished.isFinished | ||
@@ -54,2 +56,8 @@ /** | ||
// ignore 404 on in-flight response | ||
if (!err && res._header) { | ||
debug('cannot 404 after headers sent') | ||
return | ||
} | ||
// unhandled error | ||
@@ -124,3 +132,3 @@ if (err) { | ||
if (!req.readable) { | ||
if (isFinished(req)) { | ||
write() | ||
@@ -134,3 +142,3 @@ return | ||
// flush the request | ||
req.once('end', write) | ||
onFinished(req, write) | ||
req.resume() | ||
@@ -137,0 +145,0 @@ } |
{ | ||
"name": "finalhandler", | ||
"description": "Node.js final http responder", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
@@ -10,6 +10,7 @@ "license": "MIT", | ||
"debug": "~2.0.0", | ||
"escape-html": "1.0.1" | ||
"escape-html": "1.0.1", | ||
"on-finished": "~2.1.0" | ||
}, | ||
"devDependencies": { | ||
"istanbul": "0.3.0", | ||
"istanbul": "0.3.2", | ||
"mocha": "~1.21.4", | ||
@@ -26,3 +27,3 @@ "readable-stream": "~1.0.27", | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
"node": ">= 0.8" | ||
}, | ||
@@ -29,0 +30,0 @@ "scripts": { |
@@ -126,3 +126,3 @@ # finalhandler | ||
[npm-url]: https://npmjs.org/package/finalhandler | ||
[node-image]: http://img.shields.io/badge/node.js-%3E%3D_0.8-brightgreen.svg?style=flat | ||
[node-image]: https://img.shields.io/node/v/finalhandler.svg?style=flat | ||
[node-url]: http://nodejs.org/download/ | ||
@@ -133,3 +133,3 @@ [travis-image]: https://img.shields.io/travis/pillarjs/finalhandler.svg?style=flat | ||
[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master | ||
[downloads-image]: http://img.shields.io/npm/dm/finalhandler.svg?style=flat | ||
[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg?style=flat | ||
[downloads-url]: https://npmjs.org/package/finalhandler |
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
9532
137
3
+ Addedon-finished@~2.1.0
+ Addedee-first@1.1.0(transitive)
+ Addedon-finished@2.1.1(transitive)