Follow 302 redirects with "Location" header
This commit is contained in:
parent
13d9420c94
commit
15f06f254f
@ -309,7 +309,13 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
|
|||||||
});
|
});
|
||||||
response.on('end', function () {
|
response.on('end', function () {
|
||||||
if( response.statusCode != 200 ) {
|
if( response.statusCode != 200 ) {
|
||||||
callback({ statusCode: response.statusCode, data: data });
|
// Follow 302 redirects with Location HTTP header
|
||||||
|
if(response.statusCode == 302 && response.headers.location) {
|
||||||
|
self._performSecureRequest( oauth_token, oauth_token_secret, method, response.headers.location, extra_params, post_body, post_content_type, callback);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
callback({ statusCode: response.statusCode, data: data }, data, response);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
callback(null, data, response);
|
callback(null, data, response);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user