Match all 2xx response codes.

This commit is contained in:
Neil Mansilla 2011-06-23 09:14:46 -07:00
parent dfe4c02ff1
commit c78a9ca129

View File

@ -350,7 +350,7 @@ 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 ) { if (!( response.statusCode >= 200 && response.statusCode <= 299 )) {
// 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);