依赖
implementation 'com.squareup.okhttp3:okhttp:3.7.0'
implementation 'com.squareup.okio:okio:1.12.0'
public class OkHttp3 {
private static final String TAG = "HttpUtils";
private static volatile OkHttp3 instance;
public Handler handler = new Handler();
private final OkHttpClient client;
private Interceptor getAppInterceptor(){
Interceptor interceptor = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Log.e("++++++","拦截前");
Response response = chain.proceed(request);
Log.e("++++++","拦截后");
//请求之后
return response;