如何在使用axiosredirect之后获取着陆页url

如果我在maxRedirects = 5的情况下使用axios,如果我input一个将被redirect到另一个URL的URL,我如何才能从最终的login页面获取URL? 在HTTP标题中,当有200个代码时,没有用于login页面的标题字段。

例如:如果我使用

axios.get('http://stackoverflow.com/',config) .then(function(response) { console.log(response);} 

它将redirect到https://stackoverflow.com 。 那么怎么才能得到最终的URL值“ https://stackoverflow.com ”?

我应该调查并重新创build完整的url吗?

这是我的快速和肮脏的解决scheme。 起始url是http://www.stackoverflow.com/questions/47444251/how-to-get-the-landing-page-url-after-redirections-using-axios ,最后的登陆url是如何获得登陆使用axiosredirect后的页面URL请在下面find获取着陆URL的技巧。

 axios.get('http://www.stackoverflow.com/questions/47444251/how-to-get-the-landing-page-url-after-redirections-using-axios').then(function(response) { console.log(response.request.res.req.agent.protocol+"//"+response.request.res.connection._host+response.request.path); }).catch(function(no200){ console.error("404, 400, and other events"); console.log(no200.request.res.req.agent.protocol+"//"+no200.request.res.connection._host+no200.request.path); });