Skip to content

Commit

Permalink
feat: ensure json encoding to UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
UlisesGascon committed Apr 17, 2024
1 parent 6abec20 commit 2c5ba64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/response.js
Expand Up @@ -273,7 +273,7 @@ res.json = function json(obj) {

// content-type
if (!this.get('Content-Type')) {
this.set('Content-Type', 'application/json');
this.set('Content-Type', 'application/json; charset=utf-8');
}

return this.send(body);
Expand Down Expand Up @@ -318,7 +318,7 @@ res.jsonp = function jsonp(obj) {
// content-type
if (!this.get('Content-Type')) {
this.set('X-Content-Type-Options', 'nosniff');
this.set('Content-Type', 'application/json');
this.set('Content-Type', 'application/json; charset=utf-8');
}

// fixup callback
Expand Down

0 comments on commit 2c5ba64

Please sign in to comment.