2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-14 18:42:33 +03:00

use Buffer global in http.js

Since the http adapter is never used in the browser it's safe to use
the Buffer global and its isBuffer() method directly.
This commit is contained in:
Felix Gnass
2017-05-04 23:43:59 +02:00
parent c82753ce54
commit c8494677bb
+1 -2
View File
@@ -10,7 +10,6 @@ var httpsFollow = require('follow-redirects').https;
var url = require('url');
var zlib = require('zlib');
var pkg = require('./../../package.json');
var Buffer = require('buffer').Buffer;
var createError = require('../core/createError');
var enhanceError = require('../core/enhanceError');
@@ -30,7 +29,7 @@ module.exports = function httpAdapter(config) {
}
if (data && !utils.isStream(data)) {
if (utils.isBuffer(data)) {
if (Buffer.isBuffer(data)) {
// Nothing to do...
} else if (utils.isArrayBuffer(data)) {
data = new Buffer(new Uint8Array(data));