res, err := new(http.Transport).RoundTrip(req) res, err := new(http.Transport).RoundTrip(req) client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
Then use the client as normal. You can also modify the function for very specific redirect behavior.Granted, part of it is that it's too complex to be captured by one timeout, but everyone wants one timeout. kinda like string-sub-slicing and UTF-8 multi-byte characters - it's a Bad Idea™ because the over-simplified stuff is fundamentally wrong and will often cause problems. E.g. I routinely encounter tools with short timeouts that don't work on slow network connections (e.g. Bazel), despite actively downloading - what you generally want for user-use is a timeout that ensures the download does not hang forever doing nothing, not the download completes within a specific amount of time.
... but also it's just abnormally bad.
I'd love to see this one addressed but it's not looking too hopeful at this stage.