gorequest icon indicating copy to clipboard operation
gorequest copied to clipboard

Retry implementation is wrong

Open bhuvanvenkat-plivo opened this issue 4 years ago • 0 comments

https://github.com/parnurzeal/gorequest/blob/develop/gorequest.go#L1102

for {
	resp, body, errs = s.getResponseBytes()
	if errs != nil {
		return nil, nil, errs
	}
	if s.isRetryableRequest(resp) {
		resp.Header.Set("Retry-Count", strconv.Itoa(s.Retryable.Attempt))
		break
	}
}

s.getResponseBytes() will be executing the http request. Any error set in s.Errors or errs is not nil isRetryableRequest() check is not performed. Any retry set to the SuperAgent object is not considered.

bhuvanvenkat-plivo avatar Dec 01 '20 18:12 bhuvanvenkat-plivo