10000 Remove charset in tests (#3807) · darth-coder-js/axios@dbc634c · GitHub
[go: up one dir, main page]

Skip to content

Commit dbc634c

Browse files
timemachine3030mpark86jasonsaaymanPilot
authored
Remove charset in tests (axios#3807)
* removed charset setting when setting default header * Remove charset from tests Co-authored-by: mpark86 <dev.minuk.park@gmail.com> Co-authored-by: Jay <jasonsaayman@gmail.com> Co-authored-by: Pilot <timemachine@ctrl-c.club>
1 parent 3958e9f commit dbc634c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var defaults = {
5757
return data.toString();
5858
}
5959
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
60-
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
60+
setContentTypeIfUnset(headers, 'application/json');
6161
return JSON.stringify(data);
6262
}
6363
return data;

test/specs/headers.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('headers', function () {
9090
});
9191

9292
getAjaxRequest().then(function (request) {
93-
testHeaderValue(request.requestHeaders, 'Content-Type', 'application/json;charset=utf-8');
93+
testHeaderValue(request.requestHeaders, 'Content-Type', 'application/json');
9494
done();
9595
});
9696
});

test/unit/adapters/http.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('supports http with nodejs', function () {
124124
};
125125

126126
server = http.createServer(function (req, res) {
127-
res.setHeader('Content-Type', 'application/json;charset=utf-8');
127+
res.setHeader('Content-Type', 'application/json');
128128
res.end(JSON.stringify(data));
129129
}).listen(4444, function () {
130130
axios.get('http://localhost:4444/').then(function (res) {
@@ -142,7 +142,7 @@ describe('supports http with nodejs', function () {
142142
};
143143

144144
server = http.createServer(function (req, res) {
145-
res.setHeader('Content-Type', 'application/json;charset=utf-8');
145+
res.setHeader('Content-Type', 'application/json');
146146
var bomBuffer = Buffer.from([0xEF, 0xBB, 0xBF])
147147
var jsonBuffer = Buffer.from(JSON.stringify(data));
148148
res.end(Buffer.concat([bomBuffer, jsonBuffer]));
@@ -247,7 +247,7 @@ describe('supports http with nodejs', function () {
247247
zlib.gzip(JSON.stringify(data), function (err, zipped) {
248248

249249
server = http.createServer(function (req, res) {
250-
res.setHeader('Content-Type', 'application/json;charset=utf-8');
250+
res.setHeader('Content-Type', 'application/json');
251251
res.setHeader('Content-Encoding', 'gzip');
252252
res.end(zipped);
253253
}).listen(4444, function () {
@@ -262,7 +262,7 @@ describe('supports http with nodejs', function () {
262262

263263
it('should support gunzip error handling', function (done) {
264264
server = http.createServer(function (req, res) {
265-
res.setHeader('Content-Type', 'application/json;charset=utf-8');
265+
res.setHeader('Content-Type', 'application/json');
266266
res.setHeader('Content-Encoding', 'gzip');
267267
res.end('invalid response');
268268
}).listen(4444, function () {

0 commit comments

Comments
 (0)
0