Found a hacky solution, https://play.golang.org/p/jLlKR3yjWSw
Any better ideas?
var client = &http.Client{
CheckRedirect: setFollowURL,
}
func setFollowURL(req *http.Request, via []*http.Request) error {
via[0].URL = req.URL
if len(via) >= 10 {
return errors.New("stopped after 10 redirects")
}
return nil
}
On Monday, May 21, 2018 at 12:25:37 PM UTC+8, Darren Hoo wrote:
>
> if this is how the redirections go:
>
> A (original url) => B => C => D
>
> I want to know the url of request D
>
> the URL of A is never changed, and get the Location header from request is
> impossible.
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.