Socket
Socket
Sign inDemoInstall

superagent

Package Overview
Dependencies
Maintainers
1
Versions
173
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.15.2 to 0.15.3

2

component.json

@@ -5,3 +5,3 @@ {

"description": "awesome http requests",
"version": "0.15.2",
"version": "0.15.3",
"keywords": [

@@ -8,0 +8,0 @@ "http",

0.15.3 / 2013-07-05
==================
* fix .pipe() unzipping on more recent nodes. Closes #240
* fix passing an empty object to .query() no longer appends "?"
* fix formidable error handling
* update formidable
0.15.2 / 2013-07-02

@@ -3,0 +11,0 @@ ==================

@@ -606,3 +606,3 @@

if ('string' != typeof val) val = serialize(val);
this._query.push(val);
if (val) this._query.push(val);
return this;

@@ -609,0 +609,0 @@ };

@@ -0,1 +1,2 @@

/**

@@ -2,0 +3,0 @@ * Module dependencies.

@@ -1,6 +0,1 @@

/*!
* superagent
* Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/

@@ -25,2 +20,3 @@ /**

var qs = require('qs');
var zlib = require('zlib');
var util = require('util');

@@ -157,2 +153,3 @@

Request.prototype.attach = function(field, file, filename){
debug('attach %s %s', field, file);
this.attachments.push({

@@ -176,2 +173,3 @@ field: field,

Request.prototype.redirects = function(n){
debug('max redirects %s', n);
this._maxRedirects = n;

@@ -219,2 +217,4 @@ return this;

}
debug('set %s "%s"', field, val);
this.request().setHeader(field, val);

@@ -285,2 +285,3 @@ return this;

if (!val.length) return this;
debug('query %s', val);
req.path += (~req.path.indexOf('?') ? '&' : '?') + val;

@@ -389,5 +390,10 @@ return this;

Request.prototype.pipe = function(stream, options){
this.piped = true; // HACK...
this.buffer(false);
this.end().req.on('response', function(res){
res.pipe(stream, options);
if (/^(deflate|gzip)$/.test(res.headers['content-encoding'])) {
res.pipe(zlib.createUnzip()).pipe(stream, options);
} else {
res.pipe(stream, options);
}
});

@@ -666,3 +672,3 @@ return stream;

req.on('response', function(res){
debug('%s %s %s', res.statusCode, self.method, self.url);
debug('%s %s -> %s', self.method, self.url, res.statusCode);
var max = self._maxRedirects;

@@ -677,2 +683,9 @@ var mime = utils.type(res.headers['content-type'] || '');

if (self.piped) {
res.on('end', function(){
self.emit('end');
});
return;
}
// redirect

@@ -696,5 +709,3 @@ if (redirect && self._redirects++ != max) {

form.parse(res, function(err, fields, files){
if (err) throw err;
// TODO: handle error
// TODO: emit formidable events, parse json etc
if (err) return self.callback(err);
var response = new Response(req, res);

@@ -701,0 +712,0 @@ response.body = fields;

/*!
* superagent - Part
* Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
/**

@@ -9,0 +3,0 @@ * Module dependencies.

@@ -6,4 +6,4 @@

var StringDecoder = require('string_decoder').StringDecoder;
var Stream = require('stream');
var StringDecoder = require('string_decoder').StringDecoder;
var zlib;

@@ -57,5 +57,5 @@

return str.split(/ *; */).reduce(function(obj, str){
var parts = str.split(/ *= */)
, key = parts.shift()
, val = parts.shift();
var parts = str.split(/ *= */);
var key = parts.shift();
var val = parts.shift();

@@ -96,5 +96,5 @@ if (key && val) obj[key] = val;

var unzip = zlib.createUnzip()
, stream = new Stream
, decoder;
var unzip = zlib.createUnzip();
var stream = new Stream;
var decoder;

@@ -101,0 +101,0 @@ // make node responseOnEnd() happy

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

@@ -21,3 +21,3 @@ "keywords": [

"qs": "0.6.5",
"formidable": "1.0.9",
"formidable": "1.0.14",
"mime": "1.2.5",

@@ -30,3 +30,3 @@ "emitter-component": "1.0.0",

"devDependencies": {
"express": "3.0.3",
"express": "3.3.1",
"better-assert": "~0.1.0",

@@ -33,0 +33,0 @@ "should": "*",

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

if ('string' != typeof val) val = serialize(val);
this._query.push(val);
if (val) this._query.push(val);
return this;

@@ -1008,0 +1008,0 @@ };

var http = require('http');
var formidable = require('formidable');
var express = require('express');
var request = require('./');
var http = require('http');
var parse = require('url').parse;
var url = 'http://arstechnica.com/information-technology/2013/05/fios-customer-discovers-the-limits-of-unlimited-data-77-tb-in-month/';
var n = 10;
// var options = parse(url);
// options.method = 'HEAD';
// options.agent = false;
// var app = express();
// while (n--) {
// var req = http.request(options);
// app.get('/', function(req, res){
// res.set('Content-Type', 'multipart/form-data; boundary=awesome');
// res.write('\r\n');
// res.write('--awesome\r\n');
// res.write('Content-Disposition: attachment; name="image"; filename="something.png"\r\n');
// res.write('Content-Type: image/png\r\n');
// res.write('\r\n');
// res.write('some data');
// res.write('\r\n--awesome\r\n');
// res.write('Content-Disposition: form-data; name="name"\r\n');
// res.write('Content-Type: text/plain\r\n');
// res.write('\r\n');
// res.write('tobi');
// res.write('\r\n--awesome--');
// res.end();
// });
// req.on('response', function(res){
// console.log(res.statusCode);
// });
// app.listen(4000)
// req.on('error', function(err){
// console.log(err.message);
// http.createServer(function(req, res){
// res.setHeader('Content-Type', 'multipart/form-data; boundary=awesome');
// res.write('\r\n');
// res.write('--awesome\r\n');
// res.write('Content-Disposition: attachment; name="image"; filename="something.png"\r\n');
// res.write('Content-Type: image/png\r\n');
// res.write('\r\n');
// res.write('some data');
// res.write('\r\n--awesome\r\n');
// res.write('Content-Disposition: form-data; name="name"\r\n');
// res.write('Content-Type: text/plain\r\n');
// res.write('\r\n');
// res.write('tobi');
// res.write('\r\n--awesome--');
// res.end();
// }).listen(4000);
// // request
// // .get('http://localhost:4000')
// // .end(function(res){
// // console.log(res);
// // })
// var url = require('url');
// var opts = url.parse('http://localhost:4000');
// opts.agent = false;
// http
// .get(opts)
// .on('response', function(res){
// console.log(res.headers);
// var form = new formidable.IncomingForm;
// form.parse(res, function(err, fields, files){
// if (err) throw err;
// console.log(fields);
// console.log(files);
// });
// })
// req.end();
// }
var url = 'https://raw.github.com/visionmedia/commander.c/master/src/commander.c';
while (n--) {
request
.head(url)
.end(function(err, res){
if (err) return console.error(err.message);
console.log(res.status);
})
}
request
.get(url)
.pipe(process.stdout)
// .buffer(false)
// .end(function(err, res){
// if (err) throw err;
// console.log(res.header);
// res.on('data', function(chunk){
// console.log(chunk.toString());
// });
// });
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