http
http copied to clipboard
Get final redirected URL from response
When followRedirects is set to true for a GET request, there seems to be know way to know the final redirected URL.
An issue that reports this: https://stackoverflow.com/questions/56861837/how-to-get-redirect-url-in-dart-flutter
The request package for Node.js provides a solution like this:
https://stackoverflow.com/a/34600159/5987223
This would be useful when expanding a shortened link
I've made a pull request #321 .
If it is accepted and merged, you should be able to access final redirected URL with response.url.
this is still a problem, I am having it right now.
@clragon Unfortunately my pull request went unnoticed. I'm no longer working on this. If you really want to get this working, the best you can do is to fork the repo and patch it yourself. You can refer to my pull request; the modification is really trivial.
How to get redirected url from http
If a website abc.com redirects jkl.com and jkl.com redirects to xyz.com (Current website)
How to get the current website url xyz.com from http package
@Ronaldo7Messi10 did you find a solution yet?
@YizhePKU Can you please share the patch you prepared? The link to the pull request seems to be broken.
Alas, I've long forgotten about this and have deleted my repo. The content of the patch is still viewable here. You may need to recreate the patch yourself.
@YizhePKU Thank you