RecordingRetryPolicy

class RecordingRetryPolicy(delegate: RetryPolicy = DefaultRetryPolicy()) : RetryPolicy

A RetryPolicy that records every decision and forwards to delegate, so tests can assert how many retries happened, for which errors, and with what delays. Defaults to wrapping a DefaultRetryPolicy.

Constructors

Link copied to clipboard
constructor(delegate: RetryPolicy = DefaultRetryPolicy())

Types

Link copied to clipboard
data class Decision(val attempt: Int, val method: HttpMethod, val error: NetworkError, val delayMillis: Long?)

One recorded retry decision: the inputs and the delayMillis the delegate returned.

Properties

Link copied to clipboard

A snapshot of all decisions made so far, in order.

Functions

Link copied to clipboard
open override fun retryDelayMillis(attempt: Int, method: HttpMethod, error: NetworkError): Long?