errorhandler
Advanced tools
Comparing version 1.3.6 to 1.4.0
@@ -0,1 +1,15 @@ | ||
1.4.0 / 2015-06-10 | ||
================== | ||
* Add charset to the `Content-Type` header | ||
* Support `statusCode` property on `Error` objects | ||
* deps: accepts@~1.2.9 | ||
- deps: mime-types@~2.1.1 | ||
- deps: negotiator@0.5.3 | ||
- perf: avoid argument reassignment & argument slice | ||
- perf: avoid negotiator recursive construction | ||
- perf: enable strict mode | ||
- perf: remove unnecessary bitwise operator | ||
* deps: escape-html@1.0.2 | ||
1.3.6 / 2015-05-14 | ||
@@ -2,0 +16,0 @@ ================== |
11
index.js
@@ -10,2 +10,4 @@ /*! | ||
'use strict' | ||
/** | ||
@@ -83,2 +85,7 @@ * Module dependencies. | ||
return function errorHandler(err, req, res, next){ | ||
// respect err.statusCode | ||
if (err.statusCode) { | ||
res.statusCode = err.statusCode | ||
} | ||
// respect err.status | ||
@@ -143,7 +150,7 @@ if (err.status) { | ||
var json = JSON.stringify({ error: error }); | ||
res.setHeader('Content-Type', 'application/json'); | ||
res.setHeader('Content-Type', 'application/json; charset=utf-8') | ||
res.end(json); | ||
// plain text | ||
} else { | ||
res.setHeader('Content-Type', 'text/plain'); | ||
res.setHeader('Content-Type', 'text/plain; charset=utf-8') | ||
res.end(str) | ||
@@ -150,0 +157,0 @@ } |
{ | ||
"name": "errorhandler", | ||
"description": "Development-only error handler middleware", | ||
"version": "1.3.6", | ||
"version": "1.4.0", | ||
"contributors": [ | ||
@@ -12,9 +12,9 @@ "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
"dependencies": { | ||
"accepts": "~1.2.6", | ||
"escape-html": "1.0.1" | ||
"accepts": "~1.2.9", | ||
"escape-html": "1.0.2" | ||
}, | ||
"devDependencies": { | ||
"after": "0.8.1", | ||
"istanbul": "0.3.9", | ||
"mocha": "2.2.4", | ||
"istanbul": "0.3.15", | ||
"mocha": "2.2.5", | ||
"supertest": "1.0.1" | ||
@@ -21,0 +21,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
13221
204
+ Addedescape-html@1.0.2(transitive)
- Removedescape-html@1.0.1(transitive)
Updatedaccepts@~1.2.9
Updatedescape-html@1.0.2