@@ -46,7 +46,7 @@ import java.util.concurrent.TimeUnit
4646 * */
4747class 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