Socket
Socket
Sign inDemoInstall

request

Package Overview
Dependencies
Maintainers
1
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request - npm Package Compare versions

Comparing version 2.9.2 to 2.9.3

72

main.js

@@ -159,7 +159,7 @@ // Copyright 2010-2011 Mikeal Rogers

if (cookies) {
var cookieString = cookies.map(function (c) {
return c.name + "=" + c.value;
}).join("; ");
self.headers.Cookie = cookieString;
var cookieString = cookies.map(function (c) {
return c.name + "=" + c.value;
}).join("; ");
self.headers.Cookie = cookieString;
}

@@ -267,3 +267,3 @@

} else if (self.multipart) {
self.body = [];
self.body = []
self.headers['content-type'] = 'multipart/related;boundary="frontier"'

@@ -280,26 +280,26 @@ if (!self.multipart.forEach) throw new Error('Argument error, options.multipart.')

})
preamble += '\r\n';
self.body.push(new Buffer(preamble));
self.body.push(new Buffer(body));
self.body.push(new Buffer('\r\n'));
preamble += '\r\n'
self.body.push(new Buffer(preamble))
self.body.push(new Buffer(body))
self.body.push(new Buffer('\r\n'))
})
self.body.push(new Buffer('--frontier--'));
self.body.push(new Buffer('--frontier--'))
}
if (self.body) {
var length = 0;
var length = 0
if (!Buffer.isBuffer(self.body)) {
if (Array.isArray(self.body)) {
for (var i = 0; i < self.body.length; i++) {
length += self.body[i].length;
length += self.body[i].length
}
} else {
self.body = new Buffer(self.body)
length = self.body.length;
length = self.body.length
}
} else {
length = self.body.length;
length = self.body.length
}
if (length) {
self.headers['content-length'] = length;
self.headers['content-length'] = length
} else {

@@ -313,3 +313,3 @@ throw new Error('Argument error, options.body.')

, httpModules = self.httpModules || {}
;
self.httpModule = httpModules[protocol] || defaultModules[protocol]

@@ -337,3 +337,4 @@

self.method = self.method || 'GET'
if (log) log('%method %uri.href', self)
self.href = self.uri.href
if (log) log('%method %href', self)
self.req = self.httpModule.request(self, function (response) {

@@ -355,12 +356,6 @@ self.response = response

if (response.headers['set-cookie'] && (!self._disableCookies)) {
response.headers['set-cookie'].forEach(function(cookie) {
if (self.jar) {
// custom defined jar
self.jar.add(new Cookie(cookie));
}
else {
// add to the global cookie jar if user don't define his own
cookieJar.add(new Cookie(cookie));
}
});
response.headers['set-cookie'].forEach(function(cookie) {
if (self.jar) self.jar.add(new Cookie(cookie))
else cookieJar.add(new Cookie(cookie))
})
}

@@ -384,4 +379,7 @@

self.uri = response.headers.location
self.redirects.push( { statusCode : response.statusCode,
redirectUri: response.headers.location })
self.redirects.push(
{ statusCode : response.statusCode
, redirectUri: response.headers.location
}
)
delete self.req

@@ -485,9 +483,9 @@ delete self.agent

self.timeoutTimer = setTimeout(function() {
self.req.abort()
var e = new Error("ETIMEDOUT")
e.code = "ETIMEDOUT"
self.emit("error", e)
self.req.abort()
var e = new Error("ETIMEDOUT")
e.code = "ETIMEDOUT"
self.emit("error", e)
}, self.timeout)
}
self.req.on('error', clientErrorHandler)

@@ -524,4 +522,4 @@ }

self.body.forEach(function(part) {
self.write(part);
});
self.write(part)
})
} else {

@@ -528,0 +526,0 @@ self.write(self.body)

{ "name" : "request"
, "description" : "Simplified HTTP request client."
, "tags" : ["http", "simple", "util", "utility"]
, "version" : "2.9.2"
, "version" : "2.9.3"
, "author" : "Mikeal Rogers <mikeal.rogers@gmail.com>"

@@ -6,0 +6,0 @@ , "repository" :

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc