HttpRequestRetry

A plugin that enables the client to retry failed requests. The default retry policy is 3 retries with exponential delay. Typical usages:

// use predefined retry policies
install(HttpRequestRetry) {
retryOnServerErrors(maxRetries = 3)
exponentialDelay()
}

// use custom policies
install(HttpRequestRetry) {
maxRetries = 5
retryIf { request, response -> !response.status.isSuccess() }
retryOnExceptionIf { request, cause -> cause is NetworkError }
delayMillis { retry -> retry * 3000 } // will retry in 3, 6, 9, etc. seconds
modifyRequest { it.headers.append("X_RETRY_COUNT", retryCount.toString()) }
}