[android] #4994 - Add events=true to mapbox http requests
This commit is contained in:
@@ -16,12 +16,13 @@ import javax.net.ssl.SSLException;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
class HTTPRequest implements Callback {
|
||||
|
||||
|
||||
private static OkHttpClient mClient = new OkHttpClient();
|
||||
private final String LOG_TAG = HTTPRequest.class.getName();
|
||||
|
||||
@@ -46,6 +47,17 @@ class HTTPRequest implements Callback {
|
||||
mNativePtr = nativePtr;
|
||||
|
||||
try {
|
||||
HttpUrl httpUrl = HttpUrl.parse(resourceUrl);
|
||||
final String host = httpUrl.host().toLowerCase(MapboxConstants.MAPBOX_LOCALE);
|
||||
if (host.equals("mapbox.com") || host.endsWith(".mapbox.com")) {
|
||||
if (httpUrl.querySize() == 0) {
|
||||
resourceUrl = resourceUrl + "?";
|
||||
} else {
|
||||
resourceUrl = resourceUrl + "&";
|
||||
}
|
||||
resourceUrl = resourceUrl + "events=true";
|
||||
}
|
||||
|
||||
Request.Builder builder = new Request.Builder().url(resourceUrl).tag(resourceUrl.toLowerCase(MapboxConstants.MAPBOX_LOCALE)).addHeader("User-Agent", userAgent);
|
||||
if (etag.length() > 0) {
|
||||
builder = builder.addHeader("If-None-Match", etag);
|
||||
|
||||
Reference in New Issue
Block a user