Fix: Fiber Client does multiple requests when using Timeout() and MaxRedirectsCount() #1457 (#1464)

* Fiber Client does multiple requests when using Timeout() and MaxRedirectsCount() 🐛 #1457
pull/1465/head
RW 2021-08-02 10:43:10 +02:00 committed by GitHub
parent 5636441fe5
commit 7ad55451a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -767,16 +767,12 @@ func (a *Agent) Bytes() (code int, body []byte, errs []error) {
errs = append(errs, err)
return
}
}
if a.maxRedirectsCount > 0 && (string(req.Header.Method()) == MethodGet || string(req.Header.Method()) == MethodHead) {
} else if a.maxRedirectsCount > 0 && (string(req.Header.Method()) == MethodGet || string(req.Header.Method()) == MethodHead) {
if err := a.HostClient.DoRedirects(req, resp, a.maxRedirectsCount); err != nil {
errs = append(errs, err)
return
}
}
if err := a.HostClient.Do(req, resp); err != nil {
} else if err := a.HostClient.Do(req, resp); err != nil {
errs = append(errs, err)
}