mirror of
https://github.com/tenrok/axios.git
synced 2026-05-21 13:24:11 +03:00
Avoid unnecessary Buffer allocations (#3321)
This commit is contained in:
@@ -293,7 +293,7 @@ module.exports = function httpAdapter(config) {
|
||||
});
|
||||
|
||||
stream.on('end', function handleStreamEnd() {
|
||||
var responseData = Buffer.concat(responseBuffer);
|
||||
var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
||||
if (config.responseType !== 'arraybuffer') {
|
||||
responseData = responseData.toString(config.responseEncoding);
|
||||
if (!config.responseEncoding || config.responseEncoding === 'utf8') {
|
||||
|
||||
Reference in New Issue
Block a user