superagent
Advanced tools
Comparing version 0.6.0 to 0.7.0
0.7.0 / 2012-08-03 | ||
================== | ||
* allow `query()` to be called after the internal `req` has been created [tootallnate] | ||
0.6.0 / 2012-07-17 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -261,6 +261,6 @@ | ||
Request.prototype.query = function(obj){ | ||
this._query = this._query || {}; | ||
for (var key in obj) { | ||
this._query[key] = obj[key]; | ||
} | ||
var req = this.request(); | ||
var query = qs.stringify(obj); | ||
if (!query.length) return this; | ||
req.path += (~req.path.indexOf('?') ? '&' : '?') + query; | ||
return this; | ||
@@ -450,3 +450,2 @@ }; | ||
, data = this._data | ||
, query = this._query | ||
, url = this.url; | ||
@@ -456,3 +455,3 @@ | ||
if (0 != url.indexOf('http')) url = 'http://' + url; | ||
url = parse(url); | ||
url = parse(url, true); | ||
@@ -465,12 +464,2 @@ // options | ||
if (null == url.query) url.query = ''; | ||
// querystring | ||
if (query) { | ||
query = qs.stringify(query); | ||
url.query += (url.query.length ? '&' : '') + query; | ||
} | ||
if (url.query.length) options.path += '?' + url.query; | ||
// initiate request | ||
@@ -492,2 +481,5 @@ var mod = exports.protocols[url.protocol]; | ||
// query | ||
this.query(url.query); | ||
return req; | ||
@@ -494,0 +486,0 @@ }; |
{ | ||
"name": "superagent" | ||
, "version": "0.6.0" | ||
, "version": "0.7.0" | ||
, "description": "elegant & feature rich browser / node HTTP with a fluent API" | ||
@@ -16,3 +16,3 @@ , "keywords": ["http", "ajax", "request", "agent"] | ||
, "devDependencies": { | ||
"express": "3.0.0beta5" | ||
"express": "3.0.0beta4" | ||
, "should": "*" | ||
@@ -19,0 +19,0 @@ , "mocha": "*" |
85990
2567