提交 32dfc1d9 编写于 作者: K Konstantin Baumann

add test case for `transparent decompression` for `content-encoding` being set...

add test case for `transparent decompression` for `content-encoding` being set in the response headers
上级 b3a4ff03
var axios = require('../../../index');
var http = require('http');
var zlib = require('zlib');
var server;
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) {
var str = Array(100000).join('ж');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册