mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Merge pull request #128 from Kosta-Github/allow_arraybuffer_response
fixing http adapter WRT `responseType === 'arraybuffer'`
This commit is contained in:
@@ -65,9 +65,13 @@ module.exports = function httpAdapter(resolve, reject, config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
res.on('end', function () {
|
res.on('end', function () {
|
||||||
|
var data = Buffer.concat(responseBuffer);
|
||||||
|
if (config.responseType !== 'arraybuffer') {
|
||||||
|
data = data.toString('utf8');
|
||||||
|
}
|
||||||
var response = {
|
var response = {
|
||||||
data: transformData(
|
data: transformData(
|
||||||
Buffer.concat(responseBuffer).toString('utf8'),
|
data,
|
||||||
res.headers,
|
res.headers,
|
||||||
config.transformResponse
|
config.transformResponse
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user