Added support and test coverage for following 301 redirects

This commit is contained in:
bdickason
2011-07-07 02:42:55 -04:00
parent 5707c480df
commit d8b5731446
2 changed files with 70 additions and 2 deletions

View File

@ -353,8 +353,8 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
if ( response.statusCode >= 200 && response.statusCode <= 299 ) {
callback(null, data, response);
} else {
// Follow 302 redirects with Location HTTP header
if(response.statusCode == 302 && response.headers && response.headers.location) {
// Follow 301 or 302 redirects with Location HTTP header
if((response.statusCode == 301 || 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);
}
else {