From 2c5ba6453574fa58b592ff58a6040eaf10434f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulises=20Gasc=C3=B3n?= Date: Wed, 17 Apr 2024 15:48:24 +0200 Subject: [PATCH] feat: ensure json encoding to UTF-8 --- lib/response.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/response.js b/lib/response.js index dd7b3c8201..e8f5053d09 100644 --- a/lib/response.js +++ b/lib/response.js @@ -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); @@ -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