2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-02 16:04:10 +03:00

http adapter: return a Buffer instead of a String in case of responseType === 'arraybuffer'

This commit is contained in:
Konstantin Baumann
2015-10-15 17:28:38 +02:00
parent 84027a31b4
commit 84a0ddecd4
+5 -1
View File
@@ -65,9 +65,13 @@ module.exports = function httpAdapter(resolve, reject, config) {
});
res.on('end', function () {
var data = Buffer.concat(responseBuffer);
if (config.responseType !== 'arraybuffer') {
data = data.toString('utf8');
}
var response = {
data: transformData(
Buffer.concat(responseBuffer).toString('utf8'),
data,
res.headers,
config.transformResponse
),