OkHttp如何添加拦截器

OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Log.i(“intercept”, request.url().host());
return chain.proceed(request);
}
}).build();

你可能感兴趣的:(OkHttp如何添加拦截器)