Skip to content

Instantly share code, notes, and snippets.

@gartesk
gartesk / CompositeInterceptor.kt
Created April 15, 2019 07:57
Composite interceptor for OkHttp (Android). Allows to insert multiple interceptors as one
import okhttp3.*
import java.util.concurrent.TimeUnit
class CompositeInterceptor(private val interceptors: List<Interceptor>) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val wrappingChain = WrappingChain(chain, interceptors)
return wrappingChain.proceed(chain.request())
}
}