requestWithRetry makes an HTTP request with retry logic and exponential backoff. It retries up to maxRetries times on transient errors (timeouts, connection errors). On HTTP 429, it retries with backoff if rateLimit is false; returns ErrRateLimited if rateLimit is true.
(method, uri string, headers []header, proxy *url.URL, rateLimit bool, timeout int, redirect bool)
| 115 | // It retries up to maxRetries times on transient errors (timeouts, connection errors). |
| 116 | // On HTTP 429, it retries with backoff if rateLimit is false; returns ErrRateLimited if rateLimit is true. |
| 117 | func requestWithRetry(method, uri string, headers []header, proxy *url.URL, rateLimit bool, timeout int, redirect bool) (ResponseInfo, error) { |
| 118 | return requestWithRetryBody(method, uri, headers, "", proxy, rateLimit, timeout, redirect) |
| 119 | } |
| 120 | |
| 121 | func requestWithRetryBody(method, uri string, headers []header, body string, proxy *url.URL, rateLimit bool, timeout int, redirect bool) (ResponseInfo, error) { |
| 122 | maxRetries := retryCount |
no test coverage detected