-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPIUtils.java
More file actions
29 lines (25 loc) · 1.17 KB
/
APIUtils.java
File metadata and controls
29 lines (25 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.devcycle.sdk.server.common.api;
import com.devcycle.sdk.server.common.interceptor.CustomHeaderInterceptor;
import okhttp3.OkHttpClient;
public class APIUtils {
public static void applyRestOptions(IRestOptions restOptions, OkHttpClient.Builder builder) {
if (restOptions != null) {
if (restOptions.getHostnameVerifier() != null) {
builder.hostnameVerifier(restOptions.getHostnameVerifier());
}
if (restOptions.getProxy() != null) {
builder.proxy(restOptions.getProxy());
}
if (restOptions.getProxyAuthenticator() != null) {
builder.proxyAuthenticator(restOptions.getProxyAuthenticator());
}
if (restOptions.getProxySelector() != null) {
builder.proxySelector(restOptions.getProxySelector());
}
if (restOptions.getSocketFactory() != null && restOptions.getTrustManager() != null) {
builder.sslSocketFactory(restOptions.getSocketFactory(), restOptions.getTrustManager());
}
builder.addInterceptor(new CustomHeaderInterceptor(restOptions));
}
}
}