mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
add test case for transparent decompression for content-encoding being set in the response headers
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
var axios = require('../../../index');
|
var axios = require('../../../index');
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
|
var zlib = require('zlib');
|
||||||
var server;
|
var server;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -27,6 +28,29 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testTransparentGunzip: function (test) {
|
||||||
|
var data = {
|
||||||
|
firstName: 'Fred',
|
||||||
|
lastName: 'Flintstone',
|
||||||
|
emailAddr: 'fred@example.com'
|
||||||
|
};
|
||||||
|
|
||||||
|
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-Encoding', 'gzip');
|
||||||
|
res.end(zipped);
|
||||||
|
}).listen(4444, function () {
|
||||||
|
axios.get('http://localhost:4444/').then(function (res) {
|
||||||
|
test.deepEqual(res.data, data);
|
||||||
|
test.done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
testUTF8: function (test) {
|
testUTF8: function (test) {
|
||||||
var str = Array(100000).join('ж');
|
var str = Array(100000).join('ж');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user