移除网络请求的硬盘缓存(内存缓存就够了!)
This commit is contained in:
@@ -145,7 +145,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
|
||||
return level;
|
||||
}
|
||||
|
||||
@Override public Response intercept(Chain chain) throws IOException {
|
||||
@Override public synchronized Response intercept(Chain chain) throws IOException {
|
||||
Level level = this.level;
|
||||
|
||||
Request request = chain.request();
|
||||
|
@@ -46,14 +46,11 @@ public final class RxNetManager {
|
||||
private OkHttpClient mOkHttpClient;
|
||||
private OkHttpClient.Builder mBuilder;
|
||||
|
||||
private CacheManager mCacheManager;
|
||||
|
||||
private Retrofit mRetrofit;
|
||||
|
||||
RxNetManager(Context context, String baseUrl, Cache cache, int readTimeout,
|
||||
int writeTimeout, int connectTimeout, List<Interceptor> interceptors,
|
||||
HttpsUtils.SSLParams sslParams, HostnameVerifier hostnameVerifier) {
|
||||
mCacheManager = new CacheManager(context);
|
||||
|
||||
mBuilder = new OkHttpClient.Builder();
|
||||
|
||||
@@ -76,11 +73,7 @@ public final class RxNetManager {
|
||||
mBuilder.readTimeout(readTimeout > 0 ? readTimeout : DEFAULT_READ_TIME_OUT, TimeUnit.MILLISECONDS)
|
||||
.writeTimeout(writeTimeout > 0 ? writeTimeout : DEFAULT_WRITE_TIME_OUT, TimeUnit.MILLISECONDS)
|
||||
.connectTimeout(connectTimeout > 0 ? connectTimeout : DEFAULT_CONNECT_TIME_OUT, TimeUnit.MILLISECONDS)
|
||||
.addNetworkInterceptor(mCacheManager.getHttpCacheInterceptor())
|
||||
.cache(cache != null ? cache : mCacheManager.getCache())
|
||||
.connectionPool(new ConnectionPool(10, 5, TimeUnit.MINUTES))
|
||||
|
||||
;
|
||||
.connectionPool(new ConnectionPool(10, 5, TimeUnit.MINUTES));
|
||||
// 无代理设置,防止被抓包
|
||||
// 指定只要不是 release 包都可以抓包,方便测试进行验证问题
|
||||
if (Objects.equals(BuildConfig.BUILD_TYPE, "release")) {
|
||||
|
Reference in New Issue
Block a user