Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "popsicle", | ||
"main": "popsicle.js", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"homepage": "https://github.com/blakeembrey/popsicle", | ||
@@ -6,0 +6,0 @@ "authors": [ |
{ | ||
"name": "popsicle", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Simple HTTP requests for node and the browser", | ||
@@ -5,0 +5,0 @@ "main": "popsicle.js", |
@@ -85,2 +85,20 @@ (function (root) { | ||
/** | ||
* Return the byte length of an input. | ||
* | ||
* @param {(String|Buffer)} data | ||
* @return {Number} | ||
*/ | ||
function byteLength (data) { | ||
if (Buffer.isBuffer(data)) { | ||
return data.length; | ||
} | ||
if (typeof data === 'string') { | ||
return Buffer.byteLength(data); | ||
} | ||
return 0; | ||
} | ||
/** | ||
* Create a stream error instance. | ||
@@ -526,3 +544,3 @@ * | ||
request.write = function (data) { | ||
self._setRequestLength(self._requestLength + Buffer.byteLength(data)); | ||
self._setRequestLength(self._requestLength + byteLength(data)); | ||
@@ -547,3 +565,4 @@ return write.apply(request, arguments); | ||
function onResponseData (data) { | ||
self._setResponseLength(self._responseLength + Buffer.byteLength(data)); | ||
// Data should always be a `Buffer` instance. | ||
self._setResponseLength(self._responseLength + data.length); | ||
} | ||
@@ -550,0 +569,0 @@ |
@@ -1,2 +0,4 @@ | ||
var isPhantom = window.outerWidth === 0 && window.outerHeight === 0; | ||
var isPhantom = typeof window !== 'undefined' && | ||
window.outerWidth === 0 && | ||
window.outerHeight === 0; | ||
@@ -3,0 +5,0 @@ var REMOTE_URL = 'http://localhost:4567'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68683
1841