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

superagent

Package Overview
Dependencies
Maintainers
1
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.11.0 to 0.12.0

5

History.md
0.12.0 / 2013-01-04
==================
* add header persistence on redirects
0.11.0 / 2013-01-02

@@ -3,0 +8,0 @@ ==================

11

lib/node/index.js

@@ -454,2 +454,3 @@ /*!

// location
if (!~url.indexOf('://')) {

@@ -462,6 +463,13 @@ if (0 != url.indexOf('//')) {

// strip Content-* related fields
// in case of POST etc
var header = utils.cleanHeader(this.req._headers);
delete this.req;
// force GET
this.method = 'HEAD' == this.method
? this.method
? 'HEAD'
: 'GET';
// redirect
this._data = null;

@@ -471,2 +479,3 @@ this.url = url;

this.emit('redirect', res);
this.set(header);
this.end(this._callback);

@@ -473,0 +482,0 @@ return this;

@@ -132,2 +132,18 @@

};
};
};
/**
* Strip content related fields from `header`.
*
* @param {Object} header
* @return {Object} header
* @api private
*/
exports.cleanHeader = function(header){
delete header['content-type'];
delete header['content-length'];
delete header['transfer-encoding'];
delete header['cookie'];
return header;
};

2

package.json
{
"name": "superagent",
"version": "0.11.0",
"version": "0.12.0",
"description": "elegant & feature rich browser / node HTTP with a fluent API",

@@ -5,0 +5,0 @@ "keywords": [

var express = require('express');
var app = express();
app.use(express.cookieParser('something'));
app.use(express.session());
app.get('/', function(req, res){
if (!req.session.n) req.session.n = Math.random();
res.send('hello ' + req.session.n);
});
app.listen(4000);
var request = require('./');
var agent = request.agent();
request
.get('http://component.io/components/:action/:query')
.params({ action: 'search', query: 'ui' })
.end(function(res){
console.log(res.body);
})
var n = 3;
function next() {
agent
.get('http://localhost:4000/')
.end(function(res){
console.log(res.text);
if (n--) process.nextTick(next);
});
}
next();
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