use of com.justwayward.reader.api.support.HeaderInterceptor in project BookReader by JustWayward.
the class BookApiModule method provideOkHttpClient.
@Provides
public OkHttpClient provideOkHttpClient() {
LoggingInterceptor logging = new LoggingInterceptor(new Logger());
logging.setLevel(LoggingInterceptor.Level.BODY);
OkHttpClient.Builder builder = new OkHttpClient.Builder().connectTimeout(10, TimeUnit.SECONDS).connectTimeout(20 * 1000, TimeUnit.MILLISECONDS).readTimeout(20 * 1000, TimeUnit.MILLISECONDS).retryOnConnectionFailure(// 失败重发
true).addInterceptor(new HeaderInterceptor()).addInterceptor(logging);
return builder.build();
}
Aggregations