2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00

Remove charset in tests (#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>
This commit is contained in:
Daniel Lopretto
2021-05-21 01:51:31 -04:00
committed by GitHub
parent 3958e9fbc8
commit dbc634cf70
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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();
});
});
+4 -4
View File
@@ -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 () {