Comparing version 2.9.3 to 2.9.100
32
main.js
@@ -25,2 +25,3 @@ // Copyright 2010-2011 Mikeal Rogers | ||
, uuid = require('./uuid') | ||
, ForeverAgent = require('./forever') | ||
, Cookie = require('./vendor/cookie') | ||
@@ -188,2 +189,8 @@ , CookieJar = require('./vendor/cookie/jar') | ||
if (setHost) delete self.headers.host | ||
if (self.req._reusedSocket && error.code === 'ECONNRESET') { | ||
self.agent = {addRequest: ForeverAgent.prototype.addRequestNoreuse.bind(self.agent)} | ||
self.start() | ||
self.req.end() | ||
return | ||
} | ||
if (self.timeout && self.timeoutTimer) clearTimeout(self.timeoutTimer) | ||
@@ -269,3 +276,9 @@ self.emit('error', error) | ||
self.body = [] | ||
self.headers['content-type'] = 'multipart/related;boundary="frontier"' | ||
if (!self.headers['content-type']) { | ||
self.headers['content-type'] = 'multipart/related;boundary="frontier"'; | ||
} else { | ||
self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"'; | ||
} | ||
if (!self.multipart.forEach) throw new Error('Argument error, options.multipart.') | ||
@@ -323,3 +336,3 @@ | ||
// Don't use our pooling if node has the refactored client | ||
self.agent = self.httpModule.globalAgent || self.getAgent(self.host, self.port) | ||
self.agent = self.agent || self.httpModule.globalAgent || self.getAgent(self.host, self.port) | ||
self.agent.maxSockets = self.maxSockets | ||
@@ -329,3 +342,3 @@ } | ||
// Don't use our pooling if node has the refactored client | ||
self.agent = self.httpModule.globalAgent || self.getAgent(self.host, self.port) | ||
self.agent = self.agent || self.httpModule.globalAgent || self.getAgent(self.host, self.port) | ||
self.agent.maxSockets = self.pool.maxSockets | ||
@@ -479,3 +492,3 @@ } | ||
if (self.timeout) { | ||
if (self.timeout && !self.timeoutTimer) { | ||
self.timeoutTimer = setTimeout(function() { | ||
@@ -604,2 +617,13 @@ self.req.abort() | ||
request.forever = function (agentOptions, optionsArg) { | ||
var options = {} | ||
if (agentOptions) { | ||
for (option in optionsArg) { | ||
options[option] = optionsArg[option] | ||
} | ||
} | ||
options.agent = new ForeverAgent(agentOptions) | ||
return request.defaults(options) | ||
} | ||
request.get = request | ||
@@ -606,0 +630,0 @@ request.post = function (options, callback) { |
{ "name" : "request" | ||
, "description" : "Simplified HTTP request client." | ||
, "tags" : ["http", "simple", "util", "utility"] | ||
, "version" : "2.9.3" | ||
, "version" : "2.9.100" | ||
, "author" : "Mikeal Rogers <mikeal.rogers@gmail.com>" | ||
@@ -6,0 +6,0 @@ , "repository" : |
@@ -152,2 +152,3 @@ # Request -- Simplified HTTP request method | ||
* `body` - entity body for POST and PUT requests. Must be buffer or string. | ||
* `form` - sets `body` but to querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. | ||
* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. | ||
@@ -154,0 +155,0 @@ * `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. |
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
Network access
Supply chain riskThis module accesses the network.
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
117476
26
1818
287
9