Comparing version 2.9.150 to 2.9.151
23
main.js
@@ -81,6 +81,5 @@ // Copyright 2010-2012 Mikeal Rogers | ||
function Request (options) { | ||
var self = this | ||
stream.Stream.call(self) | ||
self.readable = true | ||
self.writable = true | ||
stream.Stream.call(this) | ||
this.readable = true | ||
this.writable = true | ||
@@ -90,7 +89,7 @@ if (typeof options === 'string') { | ||
} | ||
var reserved = Object.keys(Request.prototype) | ||
for (var i in options) { | ||
if (reserved.indexOf(i) === -1) { | ||
self[i] = options[i] | ||
this[i] = options[i] | ||
} else { | ||
@@ -104,2 +103,10 @@ if (typeof options[i] === 'function') { | ||
this.init(options) | ||
} | ||
util.inherits(Request, stream.Stream) | ||
Request.prototype.init = function (options) { | ||
var self = this | ||
if (!options) options = {} | ||
if (!self.pool) self.pool = globalPool | ||
@@ -313,3 +320,2 @@ self.dests = [] | ||
} | ||
util.inherits(Request, stream.Stream) | ||
Request.prototype.getAgent = function (host, port) { | ||
@@ -379,3 +385,3 @@ if (!this.pool[host+':'+port]) { | ||
if (log) log('Redirect to %uri', self) | ||
request(self, self.callback) | ||
self.init() | ||
return // Ignore the rest of the response | ||
@@ -555,2 +561,3 @@ } else { | ||
this.setHeader('content-type', 'application/json') | ||
this.setHeader('accept', 'application/json') | ||
if (typeof val === 'boolean') { | ||
@@ -557,0 +564,0 @@ if (typeof this.body === 'object') this.body = JSON.stringify(this.body) |
{ "name" : "request" | ||
, "description" : "Simplified HTTP request client." | ||
, "tags" : ["http", "simple", "util", "utility"] | ||
, "version" : "2.9.150" | ||
, "version" : "2.9.151" | ||
, "author" : "Mikeal Rogers <mikeal.rogers@gmail.com>" | ||
@@ -6,0 +6,0 @@ , "repository" : |
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
130853
2249