File was renamed from generallibrary/src/main/java/com/dayu/general/net/MyInercepterApplication.kt |
| | |
| | | package com.dayu.general.net |
| | | |
| | | import android.text.TextUtils |
| | | import com.dayu.qiheonlinelibrary.QHOnLineApplication |
| | | import com.tencent.bugly.crashreport.CrashReport |
| | | import okhttp3.Interceptor |
| | | import okhttp3.Protocol |
| | |
| | | * Author: zuo |
| | | * Date: 2025-03-06 |
| | | */ |
| | | class MyInercepterApplication :Interceptor{ |
| | | class MyIntercepterApplication :Interceptor{ |
| | | |
| | | @Throws(IOException::class) |
| | | override fun intercept(chain: Interceptor.Chain): Response { |
| | |
| | | if (request.method == "GET") { |
| | | builder.url(request.url.toString()) |
| | | } else { |
| | | if (!TextUtils.isEmpty(QHOnLineApplication.getInstance().tokenStr)) { |
| | | builder.addHeader("Token-Cloud", QHOnLineApplication.getInstance().tokenStr) |
| | | } |
| | | |
| | | } |
| | | return builder.build() |
| | | } catch (e: Exception) { |