When using npm Request to generate a response, I am able to retrieve information like "statusCode" by using "response.statusCode". However, I am unable to retrieve other information such as "redirectUri" as it shows undefined. Is there a way to access the "redirectUri"?
Here is the code I am using to fetch the response from the URL I am testing:
var request = require('request');
var getRequest = function (url, index) {
request(url, function (error, response, body) {
console.log(response.redirectUri);
});
}
getRequest('https://www.exampleUrl.com', 1);
Here is some of the information I am trying to retrieve from the response:
redirects: [
{ statusCode: 302,
redirectUri:'https://www.exampleurl'.....etc
}],
Please refer to the attached image for the response. Please note that I have blurred out the URL that I am testing.