Package-level declarations

Types

Link copied to clipboard
class BasicAuthInterceptor(user: String, password: String) : Interceptor
Link copied to clipboard
class BearerAuthenticator(token: String, abbreviation: String = "Bearer") : Interceptor
Link copied to clipboard
class BearerAuthenticatorFromProvider(token: () -> String, abbreviation: String = "Bearer") : Interceptor
Link copied to clipboard
class ConnectivityInterceptor(context: Context) : Interceptor
Link copied to clipboard
class ContentTypeInterceptor(contentType: String = "application/json") : Interceptor
Link copied to clipboard
class EmptyInterceptor : Interceptor
Link copied to clipboard
class ForceCacheInterceptor : Interceptor

The cached response will be returned only when the Internet is available as OkHttp is designed like that. When the Internet is available and data is cached, it returns the data from the cache. Even when the data is cached and the Internet is not available, it returns with the error "no internet available". We can use the following ForceCacheInterceptor at the Application layer in addition to the above one (NetworkCacheInterceptor, only if not enabled from the server) First use addNetworkInterceptor(NetworkCacheInterceptor) then add this addInterceptor(ForceCacheInterceptor) on your http client builder

Link copied to clipboard
class GzipRequestInterceptor : Interceptor
Link copied to clipboard
class MockInterceptor(pathAndMessage: Pair<String, String>) : Interceptor

Usage: MockInterceptor( Pair("/bar", """{"foo":"baz"}"""))

Link copied to clipboard
class NetworkCacheInterceptor(maxAge: Int = 1, timeUnit: TimeUnit = TimeUnit.MINUTES, cacheControlAbbreviation: String = "Cache-control") : Interceptor

In order to cache the response build cache see @see Context.retrofitCache()

Link copied to clipboard
class RetryRequestInterceptor(maxTries: Int = 3, delayBetweenRetry: Long = TimeUnit.SECONDS.toMillis(3)) : Interceptor
Link copied to clipboard
class TooManyRequestsInterceptor(tooManyRequestsResponseCode: Int = 429, customMessage: String? = null) : Interceptor
Link copied to clipboard
class UnauthorizedInterceptor(customMessage: String? = null) : Authenticator
Link copied to clipboard
class UrlDecodedInterceptor : Interceptor