Permalink
Browse files

changed data to body, and added parsedUrl to the response for easier …

…matching
  • Loading branch information...
1 parent 087ef86 commit 81da267835b9dda8df60243de4ad946d79e33a3c @icodeforlove committed Sep 17, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/request.js
View
@@ -4,6 +4,8 @@ var http = require('http'),
qs = require('querystring');
function Request ($config) {
+ $config = $config || {};
+
this._headers = $config.headers || {};
this._timeout = $config.timeout || 4000;
this._proxies = $config.proxies;
@@ -65,10 +67,10 @@ Request.prototype = {
}
function check (response) {
- if (self._didRequestFail && self._didRequestFail.call(response, response.data)) {
+ if (self._didRequestFail && self._didRequestFail.call(response, response.body)) {
retry(response);
} else {
- callback.call(response, response.data);
+ callback.call(response, response.body);
}
}
@@ -100,7 +102,8 @@ Request.prototype = {
});
response.on('end', function () {
- response.data = data;
+ response.body = data;
+ response.parsedUrl = parts;
check(response);
});
}

0 comments on commit 81da267

Please sign in to comment.