superagent
Advanced tools
Comparing version 0.9.8 to 0.9.9
@@ -5,3 +5,3 @@ { | ||
"description": "awesome http requests", | ||
"version": "0.9.6", | ||
"version": "0.9.9", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "http", |
0.9.9 / 2012-11-14 | ||
================== | ||
* add .parse(fn) support | ||
* fix socket hangup with dates in querystring. Closes #146 | ||
* fix socket hangup "error" event when a callback of arity 2 is provided | ||
0.9.8 / 2012-11-03 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -118,5 +118,5 @@ | ||
* Default MIME type map. | ||
* | ||
* | ||
* superagent.types.xml = 'application/xml'; | ||
* | ||
* | ||
*/ | ||
@@ -134,7 +134,7 @@ | ||
* Default serialization map. | ||
* | ||
* | ||
* superagent.serialize['application/xml'] = function(obj){ | ||
* return 'generated xml here'; | ||
* }; | ||
* | ||
* | ||
*/ | ||
@@ -149,7 +149,7 @@ | ||
* Default parsers. | ||
* | ||
* | ||
* superagent.parse['application/xml'] = function(str){ | ||
* return { object parsed from str }; | ||
* }; | ||
* | ||
* | ||
*/ | ||
@@ -365,2 +365,16 @@ | ||
/** | ||
* Return an `Error` representative of this response. | ||
* | ||
* @return {Error} | ||
* @api public | ||
*/ | ||
Response.prototype.toError = function(){ | ||
var msg = 'got ' + this.status + ' response'; | ||
var err = new Error(msg); | ||
err.status = this.status; | ||
return err; | ||
}; | ||
/** | ||
* Expose `Response`. | ||
@@ -455,3 +469,3 @@ */ | ||
* .end(callback); | ||
* | ||
* | ||
* request.post('/') | ||
@@ -511,3 +525,3 @@ * .type('application/xml') | ||
* .end(callback) | ||
* | ||
* | ||
* // auto json | ||
@@ -517,3 +531,3 @@ * request.post('/user') | ||
* .end(callback) | ||
* | ||
* | ||
* // manual x-www-form-urlencoded | ||
@@ -524,3 +538,3 @@ * request.post('/user') | ||
* .end(callback) | ||
* | ||
* | ||
* // auto x-www-form-urlencoded | ||
@@ -527,0 +541,0 @@ * request.post('/user') |
@@ -1,2 +0,1 @@ | ||
/** | ||
@@ -51,3 +50,3 @@ * Module dependencies. | ||
var url = parse(req.url); | ||
var access = CookieAccess(url.host, url.pathname); | ||
var access = CookieAccess(url.host, url.pathname, 'https:' == url.protocol); | ||
var cookies = this.jar.getCookies(access).toValueString(); | ||
@@ -54,0 +53,0 @@ req.cookies = cookies; |
@@ -1,2 +0,1 @@ | ||
/*! | ||
@@ -71,4 +70,4 @@ * superagent | ||
exports.protocols = { | ||
'http:': http | ||
, 'https:': https | ||
'http:': http, | ||
'https:': https | ||
}; | ||
@@ -98,4 +97,4 @@ | ||
exports.serialize = { | ||
'application/x-www-form-urlencoded': qs.stringify | ||
, 'application/json': JSON.stringify | ||
'application/x-www-form-urlencoded': qs.stringify, | ||
'application/json': JSON.stringify | ||
}; | ||
@@ -429,2 +428,15 @@ | ||
/** | ||
* Define the parser to be used for this response. | ||
* | ||
* @param {Function} fn | ||
* @return {Request} for chaining | ||
* @api public | ||
*/ | ||
Request.prototype.parse = function(fn){ | ||
this._parser = fn; | ||
return this; | ||
}; | ||
/** | ||
* Redirect to `url | ||
@@ -529,3 +541,3 @@ * | ||
if (self._aborted) return; | ||
self.emit('error', err); | ||
self.callback(err); | ||
}); | ||
@@ -671,2 +683,5 @@ | ||
// explicit parser | ||
if (self._parser) parse = self._parser; | ||
// parse | ||
@@ -673,0 +688,0 @@ if (parse) { |
@@ -51,2 +51,16 @@ | ||
/** | ||
* Return an `Error` representative of this response. | ||
* | ||
* @return {Error} | ||
* @api public | ||
*/ | ||
Response.prototype.toError = function(){ | ||
var msg = 'got ' + this.status + ' response'; | ||
var err = new Error(msg); | ||
err.status = this.status; | ||
return err; | ||
}; | ||
/** | ||
* Set header related properties: | ||
@@ -53,0 +67,0 @@ * |
{ | ||
"name": "superagent", | ||
"version": "0.9.8", | ||
"version": "0.9.9", | ||
"description": "elegant & feature rich browser / node HTTP with a fluent API", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"dependencies": { | ||
"qs": "0.4.2", | ||
"qs": "0.5.2", | ||
"formidable": "1.0.9", | ||
@@ -26,6 +26,7 @@ "mime": "1.2.5", | ||
"methods": "0.0.1", | ||
"cookiejar": "1.3.0" | ||
"cookiejar": "1.3.0", | ||
"better-assert": "~0.1.0" | ||
}, | ||
"devDependencies": { | ||
"express": "3.0.0rc5", | ||
"express": "3.0.3", | ||
"should": "*", | ||
@@ -32,0 +33,0 @@ "mocha": "*" |
88625
2985
7
+ Addedbetter-assert@~0.1.0
+ Addedbetter-assert@0.1.0(transitive)
+ Addedcallsite@1.0.0(transitive)
+ Addedqs@0.5.2(transitive)
- Removedqs@0.4.2(transitive)
Updatedqs@0.5.2