Hey, I’ve had good luck with go-resty retrycondition by keeping it simple.
I usually retry on 5xx codes and network errors, but I also add a custom condition for specific API errors (like if the response body has a certain error message).
Here’s a quick example:
```go
client.SetRetryCondition(func(r *resty.Response, err error) bool {
return r.StatusCode() >= 500 || strings.Contains(string(r.Body()), "retry_later")
})
```
Works like a charm!
I usually retry on 5xx codes and network errors, but I also add a custom condition for specific API errors (like if the response body has a certain error message).
Here’s a quick example:
```go
client.SetRetryCondition(func(r *resty.Response, err error) bool {
return r.StatusCode() >= 500 || strings.Contains(string(r.Body()), "retry_later")
})
```
Works like a charm!
