Skip to content

Commit

Permalink
Merge pull request #128 from Kosta-Github/allow_arraybuffer_response
Browse files Browse the repository at this point in the history
fixing http adapter WRT `responseType === 'arraybuffer'`
  • Loading branch information
mzabriskie committed Oct 27, 2015
2 parents 4fc70c9 + 84a0dde commit 4d432cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/adapters/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down

0 comments on commit 4d432cf

Please sign in to comment.