resty
resty copied to clipboard
Return error when "RetryCount" is negative
In my work, we have some requests that are created at runtime. We noticed that resty retries always start at zero and when retrying with a setting of 1 resty would retry this twice.
So we made an adjustment to (Retry -1), but we started having null pointer problems when using the response.Size()
function because when our retry setting is zero, we pass -1 to the SetRetryCount
function, and to executing the request we get no error and our response is null.
I am willing to make this change!
@kaduartur Thanks for reaching out. I would like to clarify the fix approach (starting from 1 instead of 0??). I would like to avoid negative value input. Currently no validation, thinking to add that in v3.0.0.
While making changes, please this reference into consideration.
- Code reference https://github.com/go-resty/resty/blob/c1fa35881e814e06d0b49c1ea899fe65738282e0/request.go#L743-L748
- and this open PR #444