get final url #4571
get final url
#4571
-
like with the fetch api you can get the final redirected url by looking at the |
Beta Was this translation helpful? Give feedback.
Answered by
carlos-dubon
Jun 13, 2022
Replies: 1 comment
-
You can access it by accessing response.config.url or response.request.responseURL, though if you only want the URI you would need to use regex or you could use JS by utilizing a array or string method. Example: const axios require('axios');
const url = require('url');
axios(req)
.then(response => {
const parsedURL = url.parse(response.config.url);
console.log(parsedURL.host);
})
.catch(err => console.error(err)); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jasonsaayman
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can access it by accessing response.config.url or response.request.responseURL, though if you only want the URI you would need to use regex or you could use JS by utilizing a array or string method.
Example: