2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

Fixing issue with multibyte characters in node

closes #38
This commit is contained in:
mzabriskie
2015-02-02 22:04:18 -07:00
parent 59093a9c61
commit 0412c7666e
2 changed files with 48 additions and 4 deletions
+4 -4
View File
@@ -52,15 +52,15 @@ module.exports = function httpAdapter(resolve, reject, config) {
// Create the request
var transport = parsed.protocol === 'https:' ? https : http;
var req = transport.request(options, function (res) {
var responseText = '';
var responseBuffer = [];
res.on('data', function (chunk) {
responseText += chunk;
responseBuffer.push(chunk);
});
res.on('end', function () {
var response = {
data: transformData(
responseText,
Buffer.concat(responseBuffer).toString('utf8'),
res.headers,
config.transformResponse
),
@@ -83,4 +83,4 @@ module.exports = function httpAdapter(resolve, reject, config) {
// Send the request
req.end(data);
};
};