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

superagent

Package Overview
Dependencies
Maintainers
7
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superagent - npm Package Compare versions

Comparing version 0.18.2 to 0.19.0

components/component-emitter/component.json

13

History.md

@@ -0,1 +1,14 @@

0.19.0 / 2014-09-24
==================
* Add unset() to browser. (shesek)
* Prefer XHR over ActiveX. (omeid)
* Catch parse errors. (jacwright)
* Update qs dependency. (wercker)
* Add use() to node. (Financial-Times)
* Add response text to errors. (yields)
* Don't send empty cookie headers. (undoZen)
* Don't parse empty response bodies. (DveMac)
* Use hostname when setting cookie host. (prasunsultania)
0.18.2 / 2014-07-12

@@ -2,0 +15,0 @@ ==================

35

lib/client.js

@@ -357,3 +357,3 @@ /**

var parse = request.parse[this.type];
return parse
return parse && str && str.length
? parse(str)

@@ -454,5 +454,12 @@ : null;

this.on('end', function(){
var res = new Response(self);
if ('HEAD' == method) res.text = null;
self.callback(null, res);
try {
var res = new Response(self);
if ('HEAD' == method) res.text = null;
self.callback(null, res);
} catch(e) {
var err = new Error('Parser is unable to parse the response');
err.parse = true;
err.original = e;
self.callback(err);
}
});

@@ -551,2 +558,22 @@ }

/**
* Remove header `field`.
*
* Example:
*
* req.get('/')
* .unset('User-Agent')
* .end(callback);
*
* @param {String} field
* @return {Request} for chaining
* @api public
*/
Request.prototype.unset = function(field){
delete this._header[field.toLowerCase()];
delete this.header[field];
return this;
};
/**
* Get case-insensitive header `field` value.

@@ -553,0 +580,0 @@ *

2

lib/node/agent.js

@@ -52,3 +52,3 @@

var url = parse(req.url);
var access = CookieAccess(url.host, url.pathname, 'https:' == url.protocol);
var access = CookieAccess(url.hostname, url.pathname, 'https:' == url.protocol);
var cookies = this.jar.getCookies(access).toValueString();

@@ -55,0 +55,0 @@ req.cookies = cookies;

@@ -651,2 +651,11 @@

/**
* Allow for extension
*/
Request.prototype.use = function(fn) {
fn(this);
return this;
};
/**
* Return an http[s] request.

@@ -708,3 +717,3 @@ *

// add cookies
req.setHeader('Cookie', this.cookies);
if (this.cookies) req.setHeader('Cookie', this.cookies);

@@ -711,0 +720,0 @@ // set default UA

@@ -0,8 +1,10 @@

module.exports = function(res, fn){
var data = []; // Binary data needs binary storage
module.exports = function(res, fn){
var data = '';
res.on('data', function(chunk){ data += chunk; });
res.on('data', function(chunk){
data.push(chunk);
});
res.on('end', function () {
fn(null, data);
fn(null, Buffer.concat(data));
});
};
};

@@ -108,2 +108,3 @@

err.status = this.status;
err.text = this.text;
err.method = method;

@@ -110,0 +111,0 @@ err.path = path;

{
"name": "superagent",
"version": "0.18.2",
"version": "0.19.0",
"description": "elegant & feature rich browser / node HTTP with a fluent API",

@@ -23,3 +23,3 @@ "scripts": {

"dependencies": {
"qs": "0.6.6",
"qs": "1.2.0",
"formidable": "1.0.14",

@@ -39,3 +39,3 @@ "mime": "1.2.11",

"express": "3.5.0",
"better-assert": "~0.1.0",
"better-assert": "~1.0.1",
"should": "3.1.3",

@@ -56,4 +56,4 @@ "mocha": "*"

"engines": {
"node": "*"
"node": ">= 0.8"
}
}

@@ -753,3 +753,3 @@ ;(function(){

var parse = request.parse[this.type];
return parse
return parse && str && str.length
? parse(str)

@@ -850,5 +850,12 @@ : null;

this.on('end', function(){
var res = new Response(self);
if ('HEAD' == method) res.text = null;
self.callback(null, res);
try {
var res = new Response(self);
if ('HEAD' == method) res.text = null;
self.callback(null, res);
} catch(e) {
var err = new Error('Parser is unable to parse the response');
err.parse = true;
err.original = e;
self.callback(err);
}
});

@@ -947,2 +954,22 @@ }

/**
* Remove header `field`.
*
* Example:
*
* req.get('/')
* .unset('User-Agent')
* .end(callback);
*
* @param {String} field
* @return {Request} for chaining
* @api public
*/
Request.prototype.unset = function(field){
delete this._header[field.toLowerCase()];
delete this.header[field];
return this;
};
/**
* Get case-insensitive header `field` value.

@@ -949,0 +976,0 @@ *

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