summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUtil.java
blob: a8580c6105316c0a334d117c56557e99f251505b (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.mapbox.mapboxsdk.http;

import okhttp3.OkHttpClient;

/**
 * Utility class for setting OkHttpRequest configurations
 */
public class HttpRequestUtil {

  /**
   * Set the log state of OkHttpRequest. Default value is true.
   * <p>
   * This configuration will outlast the lifecycle of the Map.
   * </p>
   *
   * @param enabled True will enable logging, false will disable
   */
  public static void setLogEnabled(boolean enabled) {
    OkHttpRequest.enableLog(enabled);
  }

  /**
   * Enable printing of the request url when an error occurred. Default value is false.
   * <p>
   * Requires {@link #setLogEnabled(boolean)} to be activated.
   * </p>
   * <p>
   * This configuration will outlast the lifecycle of the Map.
   * </p>
   *
   * @param enabled True will print urls, false will disable
   */
  public static void setPrintRequestUrlOnFailure(boolean enabled) {
    OkHttpRequest.enablePrintRequestUrlOnFailure(enabled);
  }

  /**
   * Set the OkHttpClient used for requesting map resources.
   *
   * @param client the OkHttpClient
   */
  public static void setOkHttpClient(OkHttpClient client) {
    OkHttpRequest.setOkHttpClient(client);
  }

}