From 35581ea96bf1eed00679c5e6fd5e0d8d6ce316b2 Mon Sep 17 00:00:00 2001 From: Daniel Lopretto Date: Fri, 21 May 2021 01:51:31 -0400 Subject: [PATCH] Remove charset in tests (#3807) * removed charset setting when setting default header * Remove charset from tests Co-authored-by: mpark86 Co-authored-by: Jay Co-authored-by: Pilot --- lib/defaults.js | 2 +- test/specs/headers.spec.js | 2 +- test/unit/adapters/http.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/defaults.js b/lib/defaults.js index 04de40c20e..fb96bdbd13 100644 --- a/lib/defaults.js +++ b/lib/defaults.js @@ -57,7 +57,7 @@ var defaults = { return data.toString(); } if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) { - setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); + setContentTypeIfUnset(headers, 'application/json'); return JSON.stringify(data); } return data; diff --git a/test/specs/headers.spec.js b/test/specs/headers.spec.js index c9c768def2..c1d10d7b89 100644 --- a/test/specs/headers.spec.js +++ b/test/specs/headers.spec.js @@ -90,7 +90,7 @@ describe('headers', function () { }); getAjaxRequest().then(function (request) { - testHeaderValue(request.requestHeaders, 'Content-Type', 'application/json;charset=utf-8'); + testHeaderValue(request.requestHeaders, 'Content-Type', 'application/json'); done(); }); }); diff --git a/test/unit/adapters/http.js b/test/unit/adapters/http.js index 5c73cb19de..6d2c040e06 100644 --- a/test/unit/adapters/http.js +++ b/test/unit/adapters/http.js @@ -124,7 +124,7 @@ describe('supports http with nodejs', function () { }; server = http.createServer(function (req, res) { - res.setHeader('Content-Type', 'application/json;charset=utf-8'); + res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(data)); }).listen(4444, function () { axios.get('http://localhost:4444/').then(function (res) { @@ -142,7 +142,7 @@ describe('supports http with nodejs', function () { }; server = http.createServer(function (req, res) { - res.setHeader('Content-Type', 'application/json;charset=utf-8'); + res.setHeader('Content-Type', 'application/json'); var bomBuffer = Buffer.from([0xEF, 0xBB, 0xBF]) var jsonBuffer = Buffer.from(JSON.stringify(data)); res.end(Buffer.concat([bomBuffer, jsonBuffer])); @@ -247,7 +247,7 @@ describe('supports http with nodejs', function () { zlib.gzip(JSON.stringify(data), function (err, zipped) { server = http.createServer(function (req, res) { - res.setHeader('Content-Type', 'application/json;charset=utf-8'); + res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Encoding', 'gzip'); res.end(zipped); }).listen(4444, function () { @@ -262,7 +262,7 @@ describe('supports http with nodejs', function () { it('should support gunzip error handling', function (done) { server = http.createServer(function (req, res) { - res.setHeader('Content-Type', 'application/json;charset=utf-8'); + res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Encoding', 'gzip'); res.end('invalid response'); }).listen(4444, function () {