Previously the error declared during the *retryablehttp.Client.Do was being "overshadowed" by the error declared when a redirect was missing the result location.
By declaring the loc outside the call assignment, we can properly "reuse" the error and resulting check after a redirect.