http: haha content-encoding goes brrrr (enabled brotli compression)

This commit is contained in:
Alibek Omarov 2020-04-10 18:53:28 +03:00
parent 25dc0e9677
commit 01e4f13c93
2 changed files with 3 additions and 0 deletions

View File

@ -149,6 +149,7 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
implementation "com.squareup.okhttp3:okhttp-brotli:$okhttpVersion"
implementation "org.conscrypt:conscrypt-android:2.2.1"

View File

@ -32,6 +32,7 @@ import okhttp3.Cache;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.brotli.BrotliInterceptor;
public class OkHttpUtils {
@ -54,6 +55,7 @@ public class OkHttpUtils {
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.addInterceptor(getUserAgentInterceptor())
.addInterceptor(BrotliInterceptor.INSTANCE)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.cache(new Cache(context.getCacheDir(), cacheSize));