Compare commits

...

2 Commits

Author SHA1 Message Date
John Hiesey ae48c2c71c 2.0.3 2016-01-08 22:31:45 +01:00
John Hiesey 570f85ec18 Check xhr.status is non-zero to avoid running onXHRProgress on error
Previously, onXHRProgress was being run when readyState was being
set to DONE on error, which was causing exceptions.
2015-10-13 15:46:01 -07:00
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -183,12 +183,14 @@ ClientRequest.prototype._onFinish = function () {
}
/**
* Checks if xhr.status is readable. Even though the spec says it should
* be available in readyState 3, accessing it throws an exception in IE8
* Checks if xhr.status is readable and non-zero, indicating no error.
* Even though the spec says it should be available in readyState 3,
* accessing it throws an exception in IE8
*/
function statusValid (xhr) {
try {
return (xhr.status !== null)
var status = xhr.status
return (status !== null && status !== 0)
} catch (e) {
return false
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "stream-http",
"version": "2.0.2",
"version": "2.0.3",
"description": "Streaming http in the browser",
"main": "index.js",
"repository": {