Search in sources :

Example 1 with ContentTypeInterceptor

use of com.fastaccess.provider.rest.interceptors.ContentTypeInterceptor in project FastHub by k0shk0sh.

the class RestProvider method provideOkHttpClient.

public static OkHttpClient provideOkHttpClient() {
    if (okHttpClient == null) {
        OkHttpClient.Builder client = new OkHttpClient.Builder();
        if (BuildConfig.DEBUG) {
            client.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY));
        }
        client.addInterceptor(new AuthenticationInterceptor());
        client.addInterceptor(new PaginationInterceptor());
        client.addInterceptor(new ContentTypeInterceptor());
        okHttpClient = client.build();
    }
    return okHttpClient;
}
Also used : OkHttpClient(okhttp3.OkHttpClient) AuthenticationInterceptor(com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor) GsonBuilder(com.google.gson.GsonBuilder) ContentTypeInterceptor(com.fastaccess.provider.rest.interceptors.ContentTypeInterceptor) HttpLoggingInterceptor(okhttp3.logging.HttpLoggingInterceptor) PaginationInterceptor(com.fastaccess.provider.rest.interceptors.PaginationInterceptor)

Aggregations

AuthenticationInterceptor (com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor)1 ContentTypeInterceptor (com.fastaccess.provider.rest.interceptors.ContentTypeInterceptor)1 PaginationInterceptor (com.fastaccess.provider.rest.interceptors.PaginationInterceptor)1 GsonBuilder (com.google.gson.GsonBuilder)1 OkHttpClient (okhttp3.OkHttpClient)1 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)1