package com.abbidot.baselibrary.network.interceptor

import com.abbidot.baselibrary.network.base.BaseNetworkApi
import com.abbidot.baselibrary.util.LogUtil
import okhttp3.Interceptor
import okhttp3.Response

/**
 * 请求返回后的拦截器
 */
class CommonResponseInterceptor : Interceptor {

    override fun intercept(chain: Interceptor.Chain): Response {
        val startTime = System.currentTimeMillis()
        val request = chain.request()
        val response = chain.proceed(request)
        LogUtil.d(BaseNetworkApi.TAG,
                "url=${request.url}, requestTime=${System.currentTimeMillis() - startTime}ms")
        return response
    }
}