superagent
Advanced tools
Comparing version 0.5.0 to 0.5.1
0.5.1 / 2012-07-16 | ||
================== | ||
* add "methods" dep | ||
* add `.end()` arity check to node callbacks | ||
* fix unzip support due to weird node internals | ||
0.5.0 / 2012-06-16 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -17,3 +17,3 @@ | ||
, format = require('url').format | ||
, methods = require('./methods') | ||
, methods = require('methods') | ||
, utils = require('./utils') | ||
@@ -56,3 +56,3 @@ , Part = require('./part') | ||
mime.define({ | ||
'application/x-www-form-urlencoded': ['form'] | ||
'application/x-www-form-urlencoded': ['form', 'urlencoded', 'form-data'] | ||
}); | ||
@@ -126,3 +126,3 @@ | ||
this.on('response', function(res){ | ||
self.callback(res); | ||
self.callback(null, res); | ||
}); | ||
@@ -386,3 +386,3 @@ } | ||
this.emit('redirect', res); | ||
this.end(this.callback); | ||
this.end(this._callback); | ||
return this; | ||
@@ -476,2 +476,17 @@ }; | ||
/** | ||
* Invoke the callback with `err` and `res` | ||
* and handle arity check. | ||
* | ||
* @param {Error} err | ||
* @param {Response} res | ||
* @api private | ||
*/ | ||
Request.prototype.callback = function(err, res){ | ||
var fn = this._callback; | ||
if (2 == fn.length) return fn(err, res); | ||
fn(res); // TODO: emit error | ||
}; | ||
/** | ||
* Initiate request, invoking callback `fn(err, res)` | ||
@@ -493,3 +508,3 @@ * with an instanceof `Response`. | ||
// store callback | ||
this.callback = fn || noop; | ||
this._callback = fn || noop; | ||
@@ -527,3 +542,3 @@ // body | ||
if (/^(deflate|gzip)$/.test(res.headers['content-encoding'])) { | ||
utils.unzip(res); | ||
utils.unzip(req, res); | ||
} | ||
@@ -546,3 +561,3 @@ | ||
self.emit('end'); | ||
self.callback(response); | ||
self.callback(null, response); | ||
}); | ||
@@ -549,0 +564,0 @@ return; |
@@ -86,7 +86,8 @@ | ||
* | ||
* @param {http.ServerResponse} response stream | ||
* @param {Request} req | ||
* @param {Response} res | ||
* @api private | ||
*/ | ||
exports.unzip = function(res){ | ||
exports.unzip = function(req, res){ | ||
if (!zlib) return; | ||
@@ -98,2 +99,5 @@ | ||
// make node responseOnEnd() happy | ||
decodedStream.req = req; | ||
// pipe to unzip | ||
@@ -100,0 +104,0 @@ res.pipe(unzip); |
{ | ||
"name": "superagent" | ||
, "version": "0.5.0" | ||
, "description": "elegant progressive ajax client" | ||
, "version": "0.5.1" | ||
, "description": "elegant & feature rich browser / node HTTP with a fluent API" | ||
, "keywords": ["http", "ajax", "request", "agent"] | ||
, "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||
, "repository": { "type": "git", "url": "git://github.com/visionmedia/superagent.git" } | ||
, "dependencies": { | ||
@@ -12,5 +13,6 @@ "qs": "0.4.2" | ||
, "emitter-component": "0.0.1" | ||
, "methods": "0.0.1" | ||
} | ||
, "devDependencies": { | ||
"express": "2.5.x" | ||
"express": "3.0.0beta5" | ||
, "should": "*" | ||
@@ -17,0 +19,0 @@ , "mocha": "*" |
@@ -87,2 +87,6 @@ # SuperAgent | ||
## Wiki | ||
For superagent extensions such as couchdb and oauth visit the [wiki](https://github.com/visionmedia/superagent/wiki). | ||
## License | ||
@@ -89,0 +93,0 @@ |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
83910
114
2
5
2518
1
+ Addedmethods@0.0.1
+ Addedmethods@0.0.1(transitive)