Inverting the branch logic for easier reading
This commit is contained in:
parent
c78a9ca129
commit
3ed11c05bd
@ -350,7 +350,9 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
|
|||||||
data+=chunk;
|
data+=chunk;
|
||||||
});
|
});
|
||||||
response.on('end', function () {
|
response.on('end', function () {
|
||||||
if (!( response.statusCode >= 200 && response.statusCode <= 299 )) {
|
if ( response.statusCode >= 200 && response.statusCode <= 299 ) {
|
||||||
|
callback(null, data, response);
|
||||||
|
} else {
|
||||||
// Follow 302 redirects with Location HTTP header
|
// Follow 302 redirects with Location HTTP header
|
||||||
if(response.statusCode == 302 && response.headers && response.headers.location) {
|
if(response.statusCode == 302 && response.headers && response.headers.location) {
|
||||||
self._performSecureRequest( oauth_token, oauth_token_secret, method, response.headers.location, extra_params, post_body, post_content_type, callback);
|
self._performSecureRequest( oauth_token, oauth_token_secret, method, response.headers.location, extra_params, post_body, post_content_type, callback);
|
||||||
@ -358,8 +360,6 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
|
|||||||
else {
|
else {
|
||||||
callback({ statusCode: response.statusCode, data: data }, data, response);
|
callback({ statusCode: response.statusCode, data: data }, data, response);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
callback(null, data, response);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user