Compatibility with node 0.3.8

This commit is contained in:
Rasmus Andersson
2011-02-02 15:50:34 +01:00
committed by ciaranj
parent 0a786bdcbc
commit 98e432b431
2 changed files with 30 additions and 27 deletions

View File

@ -289,12 +289,12 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
if( callback ) {
var data="";
var self= this;
request.addListener('response', function (response) {
request.on('response', function (response) {
response.setEncoding('utf8');
response.addListener('data', function (chunk) {
response.on('data', function (chunk) {
data+=chunk;
});
response.addListener('end', function () {
response.on('end', function () {
if( response.statusCode != 200 ) {
callback({ statusCode: response.statusCode, data: data });
} else {
@ -303,7 +303,7 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
});
});
request.socket.addListener("error",callback);
request.on("error", callback);
if( (method == "POST" || method =="PUT") && post_body != null && post_body != "" ) {
request.write(post_body);