Skip to content

Commit

Permalink
Add charset to the Content-Type header
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jun 11, 2015
1 parent a300b6e commit 333221a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unreleased
==========

* Add charset to the `Content-Type` header
* Support `statusCode` property on `Error` objects
* deps: accepts@~1.2.9
- deps: mime-types@~2.1.1
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ exports = module.exports = function errorHandler(options) {
var error = { message: err.message, stack: err.stack };
for (var prop in err) error[prop] = err[prop];
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)
}
};
Expand Down

0 comments on commit 333221a

Please sign in to comment.