first working version

This commit is contained in:
ston1th 2023-03-15 11:07:23 +01:00
commit 39cae64854
8 changed files with 23 additions and 16 deletions

View file

@ -168,10 +168,10 @@ func (c *Client) FollowRedirect(r *http.Request, v any, delay time.Duration) (re
rr := r
for {
resp, err = c.Do(rr, v)
if !errors.Is(ErrRedirect, err) {
rdr, ok := err.(Redirect)
if !ok {
return
}
rdr := err.(Redirect)
rr, err = c.NewRequest(r.Context(), "GET", rdr.Location, nil)
if err != nil {
return