http-browserify
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -33,2 +33,6 @@ var Stream = require('stream'); | ||
var res = new Response; | ||
res.on('close', function () { | ||
self.emit('close'); | ||
}); | ||
res.on('ready', function () { | ||
@@ -61,2 +65,7 @@ self.emit('response', res); | ||
Request.prototype.destroy = function (s) { | ||
this.xhr.abort(); | ||
this.emit('close'); | ||
}; | ||
Request.prototype.end = function (s) { | ||
@@ -63,0 +72,0 @@ if (s !== undefined) this.body.write(s); |
@@ -48,4 +48,4 @@ var Stream = require('stream'); | ||
var respType = xhr.responseType.toLowerCase(); | ||
if (respType === "blob") return xhr.responseBlob; | ||
if (respType === "arraybuffer") return xhr.response; | ||
if (respType === 'blob') return xhr.responseBlob; | ||
if (respType === 'arraybuffer') return xhr.response; | ||
return xhr.responseText; | ||
@@ -83,3 +83,3 @@ } | ||
try { | ||
this.write(res); | ||
this._emitData(res); | ||
} | ||
@@ -95,3 +95,3 @@ catch (err) { | ||
} | ||
this.write(res); | ||
this._emitData(res); | ||
@@ -102,6 +102,8 @@ if (res.error) { | ||
else this.emit('end'); | ||
this.emit('close'); | ||
} | ||
}; | ||
Response.prototype.write = function (res) { | ||
Response.prototype._emitData = function (res) { | ||
var respBody = this.getResponse(res); | ||
@@ -108,0 +110,0 @@ if (respBody.toString().match(/ArrayBuffer/)) { |
{ | ||
"name" : "http-browserify", | ||
"version" : "0.1.3", | ||
"version" : "0.1.4", | ||
"description" : "http module compatability for browserify", | ||
@@ -5,0 +5,0 @@ "main" : "index.js", |
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
14574
353