Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

popsicle

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

popsicle - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

bower.json
{
"name": "popsicle",
"main": "popsicle.js",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "https://github.com/blakeembrey/popsicle",

@@ -6,0 +6,0 @@ "authors": [

{
"name": "popsicle",
"version": "0.2.0",
"version": "0.2.1",
"description": "Simple HTTP requests for node and the browser",

@@ -8,3 +8,4 @@ "main": "popsicle.js",

"request": false,
"form-data": false
"form-data": false,
"buffer": false
},

@@ -11,0 +12,0 @@ "scripts": {

(function (root) {
var isNode = typeof require === 'function' && typeof exports === 'object';
var Buffer = isNode ? require('buffer').Buffer : null;
var FormData = isNode ? require('form-data') : root.FormData;

@@ -524,3 +525,3 @@

request.write = function (data) {
self._setRequestLength(self._requestLength + data.length);
self._setRequestLength(self._requestLength + Buffer.byteLength(data));

@@ -541,7 +542,7 @@ return write.apply(request, arguments);

function onResponse (response) {
self._responseTotal = Number(response.headers['content-length']);
self._responseTotal = Number(response.headers['content-length']) || 0;
}
function onResponseData (data) {
self._setResponseLength(self._responseLength + data.length);
self._setResponseLength(self._responseLength + Buffer.byteLength(data));
}

@@ -1137,3 +1138,3 @@

trackResponseProgress(this);
trackRequestProgress(this);
}

@@ -1176,14 +1177,6 @@

xhr.getResponseHeader('Content-Length')
);
) || 0;
}
if (xhr.readyState === 3) {
self._setResponseLength(xhr.responseText.length);
}
if (xhr.readyState === 4) {
// Set the total response size to match the response length,
// in case the content length header was not available before.
self._setResponseTotal(self._responseLength);
// Clean up listeners.

@@ -1208,2 +1201,4 @@ delete xhr.onreadystatechange;

self._setResponseTotal(self._responseLength);
var res = new Response({

@@ -1221,2 +1216,8 @@ raw: xhr,

// Use `progress` events to avoid calculating byte length.
xhr.onprogress = function (e) {
self._setResponseTotal(e.total);
self._setResponseLength(e.loaded);
};
// No upload will occur with these requests.

@@ -1223,0 +1224,0 @@ if (method === 'GET' || method === 'HEAD' || !xhr.upload) {

@@ -0,1 +1,3 @@

var isPhantom = window.outerWidth === 0 && window.outerHeight === 0;
var REMOTE_URL = 'http://localhost:4567';

@@ -377,4 +379,4 @@

// Fix for PhantomJS tests (doesn't return `Content-Length` header).
if (req._xhr && e.downloaded === Infinity) {
console.warn('Browser does not support "Content-Length" header');
if (isPhantom && e.downloaded === 0 && expected === 1) {
console.warn('PhantomJS does not support "Content-Length" header');

@@ -381,0 +383,0 @@ return;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc