You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
solved
use
`var LocError = errors.New("next redirect would hit a redirect to localhost")
var badHosts = map[string]error{
"localhost": LocError,
}`
client.SetRedirectPolicy( resty.RedirectPolicyFunc(func(req *http.Request, via []*http.Request) error { return badHosts[req.URL.Host] }), )
if e, ok := err.(*url.Error); (ok && e.Err != LocError) || (!ok && err != nil) { return } fmt.Println(" Location :", resp.RawResponse.Header.Get("Location"))
and get normal location in response without redirect
Beta Was this translation helpful? Give feedback.
All reactions