2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

Adding option to disable automatic decompression (#2661)

* Adding ability to disable auto decompression

* Updating decompress documentation in README

* Fixing test\unit\adapters\http.js lint errors

* Adding test for disabling auto decompression

* Removing changes that fixed lint errors in tests

* Removing formating change to unit test

Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
This commit is contained in:
Spencer von der Ohe
2020-03-06 07:01:58 -07:00
committed by GitHub
parent 6642ca9aa1
commit 42eb9dfabc
4 changed files with 45 additions and 12 deletions
+21 -1
View File
@@ -192,6 +192,27 @@ describe('supports http with nodejs', function () {
});
});
it('should support disabling automatic decompression of response data', function(done) {
var data = 'Test data';
zlib.gzip(data, function(err, zipped) {
server = http.createServer(function(req, res) {
res.setHeader('Content-Type', 'text/html;charset=utf-8');
res.setHeader('Content-Encoding', 'gzip');
res.end(zipped);
}).listen(4444, function() {
axios.get('http://localhost:4444/', {
decompress: false,
responseType: 'arraybuffer'
}).then(function(res) {
assert.equal(res.data.toString('base64'), zipped.toString('base64'));
done();
});
});
});
});
it('should support UTF8', function (done) {
var str = Array(100000).join('ж');
@@ -731,4 +752,3 @@ describe('supports http with nodejs', function () {
});
});