superagent
Advanced tools
Comparing version 0.19.1 to 0.20.0
@@ -0,5 +1,12 @@ | ||
0.20.0 / 2014-10-02 | ||
================== | ||
* Add toJSON() to request and response instances. (yields) | ||
* Prevent HEAD requests from getting parsed. (gjohnson) | ||
* Update debug. (TooTallNate) | ||
0.19.1 / 2014-09-24 | ||
================== | ||
* Fix basic auth issue when password is falsey value. | ||
* Fix basic auth issue when password is falsey value. (gjohnson) | ||
@@ -6,0 +13,0 @@ 0.19.0 / 2014-09-24 |
@@ -821,4 +821,15 @@ | ||
var redirect = isRedirect(res.statusCode); | ||
var parser = self._parser | ||
var parser = self._parser; | ||
self.res = res; | ||
if ('HEAD' == self.method) { | ||
var response = new Response(self); | ||
self.response = response; | ||
response.redirects = self._redirectList; | ||
self.emit('response', response); | ||
self.emit('end'); | ||
return; | ||
} | ||
if (self.piped) { | ||
@@ -850,3 +861,4 @@ res.on('end', function(){ | ||
if (err) return self.callback(err); | ||
var response = new Response(req, res); | ||
var response = new Response(self); | ||
self.response = response; | ||
response.body = fields; | ||
@@ -865,3 +877,4 @@ response.files = files; | ||
if (err) return self.callback(err); | ||
var response = new Response(req, res); | ||
var response = new Response(self); | ||
self.response = response; | ||
response.body = obj; | ||
@@ -908,3 +921,4 @@ response.redirects = self._redirectList; | ||
self.res = res; | ||
var response = new Response(self.req, self.res); | ||
var response = new Response(self); | ||
self.response = response; | ||
response.redirects = self._redirectList; | ||
@@ -925,3 +939,4 @@ self.emit('response', response); | ||
// TODO: unless buffering emit earlier to stream | ||
var response = new Response(self.req, self.res); | ||
var response = new Response(self); | ||
self.response = response; | ||
response.redirects = self._redirectList; | ||
@@ -965,2 +980,17 @@ self.emit('response', response); | ||
/** | ||
* To json. | ||
* | ||
* @return {Object} | ||
* @api public | ||
*/ | ||
Request.prototype.toJSON = function(){ | ||
return { | ||
method: this.method, | ||
url: this.url, | ||
data: this._data | ||
}; | ||
}; | ||
/** | ||
* Expose `Request`. | ||
@@ -967,0 +997,0 @@ */ |
@@ -22,4 +22,3 @@ | ||
* | ||
* @param {ClientRequest} req | ||
* @param {IncomingMessage} res | ||
* @param {Request} req | ||
* @param {Object} options | ||
@@ -32,7 +31,8 @@ * @constructor | ||
function Response(req, res, options) { | ||
function Response(req, options) { | ||
Stream.call(this); | ||
options = options || {}; | ||
this.req = req; | ||
this.res = res; | ||
var res = this.res = req.res; | ||
this.request = req; | ||
this.req = req.req; | ||
this.links = {}; | ||
@@ -207,1 +207,17 @@ this.text = res.text; | ||
}; | ||
/** | ||
* To json. | ||
* | ||
* @return {Object} | ||
* @api public | ||
*/ | ||
Response.prototype.toJSON = function(){ | ||
return { | ||
req: this.request.toJSON(), | ||
header: this.header, | ||
status: this.status, | ||
text: this.text | ||
}; | ||
}; |
{ | ||
"name": "superagent", | ||
"version": "0.19.1", | ||
"version": "0.20.0", | ||
"description": "elegant & feature rich browser / node HTTP with a fluent API", | ||
@@ -29,3 +29,3 @@ "scripts": { | ||
"cookiejar": "2.0.1", | ||
"debug": "~1.0.1", | ||
"debug": "~2.0.0", | ||
"reduce-component": "1.0.1", | ||
@@ -32,0 +32,0 @@ "extend": "~1.2.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3906
110697
25
+ Addeddebug@2.0.0(transitive)
+ Addedms@0.6.2(transitive)
- Removeddebug@1.0.5(transitive)
- Removedms@2.0.0(transitive)
Updateddebug@~2.0.0