RequestInterceptors

Utility object for getting the built-in RequestInterceptors, to add to a client derived with NetworkClient.newClient.

See also

Functions

Link copied to clipboard

Creates an interceptor that, while the device is not connected, retries a retryable failure (see NetworkException.isRetryable) once connectivity returns.

Link copied to clipboard
fun retryWithBackoff(maxAttempts: Int? = 3, transientBaseDelay: TimeFrame = 100.milliseconds, throttlingBaseDelay: TimeFrame = 1.seconds, maxDelay: TimeFrame = 20.seconds, retryAfterAboveMaxDelay: RetryAfterAboveMaxDelay = RetryAfterAboveMaxDelay.GIVE_UP): RequestInterceptor

Creates an interceptor that retries retryable failures (see NetworkException.isRetryable), for example HTTP 429 and 503 or a lost connection, with a full-jitter exponential backoff, and decides when to give up.