Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.151 to 2.9.152

30

main.js

@@ -180,2 +180,4 @@ // Copyright 2010-2012 Mikeal Rogers

self.clientErrorHandler = function (error) {
if (self._aborted) return
if (self.setHost) delete self.headers.host

@@ -299,2 +301,4 @@ if (self.req._reusedSocket && error.code === 'ECONNRESET') {

process.nextTick(function () {
if (self._aborted) return
if (self.body) {

@@ -327,2 +331,5 @@ if (Array.isArray(self.body)) {

var self = this
if (self._aborted) return
self._started = true

@@ -333,2 +340,4 @@ self.method = self.method || 'GET'

self.req = self.httpModule.request(self, function (response) {
if (self._aborted) return
self.response = response

@@ -430,2 +439,4 @@ response.request = self

self.on("end", function () {
if (self._aborted) return
if (buffer.length && Buffer.isBuffer(buffer[0])) {

@@ -447,3 +458,3 @@ var body = new Buffer(bodyLen)

if (self.json) {
if (self._json) {
try {

@@ -484,2 +495,16 @@ response.body = JSON.parse(response.body)

}
Request.prototype.abort = function() {
this._aborted = true;
if (this.req) {
this.req.abort()
}
else if (this.response) {
this.response.abort()
}
this.emit("abort")
}
Request.prototype.pipeDest = function (dest) {

@@ -564,2 +589,3 @@ var response = this.response

this.setHeader('accept', 'application/json')
this._json = true
if (typeof val === 'boolean') {

@@ -769,3 +795,3 @@ if (typeof this.body === 'object') this.body = JSON.stringify(this.body)

params.options.method = 'HEAD'
if (options.body || options.requestBodyStream || options.json || options.multipart) {
if (params.options.body || params.options.requestBodyStream || params.options.json || params.options.multipart) {
throw new Error("HTTP HEAD requests MUST NOT include a request body.")

@@ -772,0 +798,0 @@ }

2

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

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

@@ -47,3 +47,3 @@ var server = require('./server')

// test .del(string, function)
request.defaults({headers:{foo:"bar"}}).del(s.url + '/del', function (e, r, b){
request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){
if (e) throw e;

@@ -50,0 +50,0 @@ assert.deepEqual('bar', b.foo);

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