Skip to content

Commit

Permalink
Updating due to changes in node HTTP client
Browse files Browse the repository at this point in the history
  • Loading branch information
lstoll committed Feb 19, 2010
1 parent af073c7 commit 2787de4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/riak.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ Client.prototype.makeRequest = function(method, url, headers, data) {

if (data) request.sendBody(data);

request.finish(function (response) {
request.addListener('response', function (response) {
var body = "";
response.addListener("body", function (chunk) { body += chunk; });
response.addListener("complete", function () {
response.addListener("data", function (chunk) { body += chunk; });
response.addListener("end", function () {
var resp = { headers: response.headers, data: body };
if ( response.statusCode < 200
|| response.statusCode >= 300) {
Expand All @@ -132,6 +132,7 @@ Client.prototype.makeRequest = function(method, url, headers, data) {
promise.emitSuccess(resp, response.statusCode);
});
});
request.close();

return promise;
}

0 comments on commit 2787de4

Please sign in to comment.