http: haha content-encoding goes brrrr (enabled brotli compression)
This commit is contained in:
parent
25dc0e9677
commit
01e4f13c93
@ -149,6 +149,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
||||||
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
|
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
|
||||||
|
implementation "com.squareup.okhttp3:okhttp-brotli:$okhttpVersion"
|
||||||
|
|
||||||
implementation "org.conscrypt:conscrypt-android:2.2.1"
|
implementation "org.conscrypt:conscrypt-android:2.2.1"
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import okhttp3.Cache;
|
|||||||
import okhttp3.Interceptor;
|
import okhttp3.Interceptor;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
import okhttp3.brotli.BrotliInterceptor;
|
||||||
|
|
||||||
public class OkHttpUtils {
|
public class OkHttpUtils {
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ public class OkHttpUtils {
|
|||||||
|
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
||||||
.addInterceptor(getUserAgentInterceptor())
|
.addInterceptor(getUserAgentInterceptor())
|
||||||
|
.addInterceptor(BrotliInterceptor.INSTANCE)
|
||||||
.readTimeout(30, TimeUnit.SECONDS)
|
.readTimeout(30, TimeUnit.SECONDS)
|
||||||
.writeTimeout(30, TimeUnit.SECONDS)
|
.writeTimeout(30, TimeUnit.SECONDS)
|
||||||
.cache(new Cache(context.getCacheDir(), cacheSize));
|
.cache(new Cache(context.getCacheDir(), cacheSize));
|
||||||
|
Loading…
Reference in New Issue
Block a user