Skip to content

Commit

Permalink
use Buffer global in http.js
Browse files Browse the repository at this point in the history
Since the http adapter is never used in the browser it's safe to use
the Buffer global and its isBuffer() method directly.
  • Loading branch information
fgnass committed May 4, 2017
1 parent c82753c commit c849467
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/adapters/http.js
Expand Up @@ -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');

Expand All @@ -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));
Expand Down

0 comments on commit c849467

Please sign in to comment.