Skip to content

Commit 47c4434

Browse files
author
Standa
committed
adds possibility to have more interceptors
1 parent e2d8e7d commit 47c4434

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

apollo-service/src/main/java/com/qusion/apolloservice/impl/ApolloServiceImpl.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import java.util.concurrent.TimeUnit
4646
* */
4747
class ApolloServiceImpl<T>(
4848
private val context: Context,
49-
private val interceptor: Interceptor? = null,
49+
private val interceptors: List<Interceptor>? = null,
5050
private val certificatePinner: CertificatePinner? = null,
5151
private val refreshToken: IRefreshToken? = null,
5252
private val customTypeAdapters: List<Pair<ScalarType, CustomTypeAdapter<T>>>,
@@ -194,9 +194,10 @@ class ApolloServiceImpl<T>(
194194
addInterceptor(HttpLoggingInterceptor().setLevel(config.HTTP_LOG_LEVEL))
195195
readTimeout(config.TIMEOUT_TIME, TimeUnit.SECONDS)
196196
writeTimeout(config.TIMEOUT_TIME, TimeUnit.SECONDS)
197-
if (interceptor != null) {
198-
addInterceptor(interceptor)
197+
interceptors?.forEach {
198+
addInterceptor(it)
199199
}
200+
200201
if (certificatePinner != null) {
201202
certificatePinner(certificatePinner)
202203
}
@@ -247,9 +248,10 @@ class ApolloServiceImpl<T>(
247248
addInterceptor(HttpLoggingInterceptor().setLevel(config.HTTP_LOG_LEVEL))
248249
readTimeout(config.TIMEOUT_TIME, TimeUnit.SECONDS)
249250
writeTimeout(config.TIMEOUT_TIME, TimeUnit.SECONDS)
250-
if (interceptor != null) {
251-
addInterceptor(interceptor)
251+
interceptors?.forEach {
252+
addInterceptor(it)
252253
}
254+
253255
if (certificatePinner != null) {
254256
certificatePinner(certificatePinner)
255257
}

0 commit comments

Comments
 (0)