Comparing version 0.3.6 to 0.3.7
{ | ||
"name": "popsicle", | ||
"main": "popsicle.js", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"homepage": "https://github.com/blakeembrey/popsicle", | ||
@@ -6,0 +6,0 @@ "authors": [ |
{ | ||
"name": "popsicle", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "Simple HTTP requests for node and the browser", | ||
@@ -5,0 +5,0 @@ "main": "popsicle.js", |
@@ -215,3 +215,3 @@ (function () { | ||
/** | ||
* Encode a URI component correctly according to the spec. | ||
* Encode a URI component according to the spec. | ||
* | ||
@@ -566,3 +566,3 @@ * @param {String} str | ||
// Alias the response instance. | ||
// Alias to the request instance. | ||
this.request.response = this; | ||
@@ -802,10 +802,2 @@ | ||
/** | ||
* Tidy up after requests. | ||
*/ | ||
Request.prototype._finished = function () { | ||
this.completed = 1; | ||
delete this._progressFns; | ||
}; | ||
/** | ||
* Allows request plugins. | ||
@@ -828,2 +820,3 @@ * | ||
// Automatic request handlers. | ||
this.use(defaultAccept); | ||
@@ -833,2 +826,10 @@ this.use(stringifyRequest); | ||
// Remove progress functions on complete. | ||
this.progress(function (e) { | ||
if (e.completed === 1) { | ||
delete self._progressFns; | ||
} | ||
}); | ||
// Catch request timeouts. | ||
if (timeout) { | ||
@@ -878,7 +879,5 @@ this._timer = setTimeout(function () { | ||
// Emit a final progress event for listeners. | ||
// Abort and emit the final progress event. | ||
this._abort(); | ||
this._emitProgress(); | ||
this._abort(); | ||
this._finished(); | ||
clearTimeout(this._timer); | ||
@@ -885,0 +884,0 @@ |
@@ -134,3 +134,3 @@ # ![Popsicle](https://cdn.rawgit.com/blakeembrey/popsicle/master/logo.svg) | ||
All percentage properties (`req.uploaded`, `req.downloaded`, `req.completed`) will be a number between `0` and `1`. When the total size is unknown (no `Content-Length` header), the percentage will automatically increment on each chunk of data returned (this will not be accurate). | ||
All percentage properties (`req.uploaded`, `req.downloaded`, `req.completed`) will be a number between `0` and `1`. When the total size is unknown (no `Content-Length` header), the percentage will automatically increment on each chunk of data returned (this will not be accurate). Aborting a request will automatically emit a completed progress event. | ||
@@ -137,0 +137,0 @@ ```javascript |
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
70723