Skip to content

Commit

Permalink
Merge pull request #887 from fgnass/no-buffer-in-browser
Browse files Browse the repository at this point in the history
No buffer in browser
  • Loading branch information
nickuraltsev committed May 31, 2017
2 parents 1beb245 + c849467 commit d1278df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 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
11 changes: 1 addition & 10 deletions lib/utils.js
@@ -1,6 +1,7 @@
'use strict';

var bind = require('./helpers/bind');
var isBuffer = require('is-buffer');

/*global toString:true*/

Expand All @@ -18,16 +19,6 @@ function isArray(val) {
return toString.call(val) === '[object Array]';
}

/**
* Determine if a value is a Node Buffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Node Buffer, otherwise false
*/
function isBuffer(val) {
return ((typeof Buffer !== 'undefined') && (Buffer.isBuffer) && (Buffer.isBuffer(val)));
}

/**
* Determine if a value is an ArrayBuffer
*
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -72,6 +72,7 @@
},
"typings": "./index.d.ts",
"dependencies": {
"follow-redirects": "^1.2.3"
"follow-redirects": "^1.2.3",
"is-buffer": "^1.1.5"
}
}

0 comments on commit d1278df

Please sign in to comment.