Revert "[sku] append sku token to offline download requests" (#173)
This reverts commit c275ad2e6d.
This commit is contained in:
@@ -6,8 +6,6 @@ import com.mapbox.mapboxsdk.Mapbox;
|
||||
|
||||
public class HttpRequestUrl {
|
||||
|
||||
private static final StringBuilder requestBuilder = new StringBuilder();
|
||||
|
||||
private HttpRequestUrl() {
|
||||
}
|
||||
|
||||
@@ -24,20 +22,20 @@ public class HttpRequestUrl {
|
||||
* @return the adapted resource url
|
||||
*/
|
||||
public static String buildResourceUrl(@NonNull String host, String resourceUrl, int querySize, boolean offline) {
|
||||
requestBuilder.setLength(0); // clear previous builder
|
||||
requestBuilder.append(resourceUrl);
|
||||
if (isValidMapboxEndpoint(host)) {
|
||||
if (querySize == 0) {
|
||||
requestBuilder.append("?");
|
||||
resourceUrl = resourceUrl + "?";
|
||||
} else {
|
||||
requestBuilder.append("&");
|
||||
resourceUrl = resourceUrl + "&";
|
||||
}
|
||||
// Only add SKU token to requests not tagged as "offline" usage.
|
||||
if (offline) {
|
||||
requestBuilder.append("offline=true&");
|
||||
resourceUrl = resourceUrl + "offline=true";
|
||||
} else {
|
||||
resourceUrl = resourceUrl + "sku=" + Mapbox.getSkuToken();
|
||||
}
|
||||
requestBuilder.append("sku=").append(Mapbox.getSkuToken());
|
||||
}
|
||||
return requestBuilder.toString();
|
||||
return resourceUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,14 +20,14 @@ class HttpRequestUrlTest {
|
||||
|
||||
@Test
|
||||
fun testOfflineFlagMapboxCom() {
|
||||
val expected = "http://mapbox.com/path/of/no/return.pbf?offline=true&sku=foobar"
|
||||
val expected = "http://mapbox.com/path/of/no/return.pbf?offline=true"
|
||||
val actual = HttpRequestUrl.buildResourceUrl("mapbox.com", "http://mapbox.com/path/of/no/return.pbf", 0, true)
|
||||
assertEquals(expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testOfflineFlagMapboxCn() {
|
||||
val expected = "http://mapbox.cn/path/of/no/return.pbf?offline=true&sku=foobar"
|
||||
val expected = "http://mapbox.cn/path/of/no/return.pbf?offline=true"
|
||||
val actual = HttpRequestUrl.buildResourceUrl("mapbox.cn", "http://mapbox.cn/path/of/no/return.pbf", 0, true)
|
||||
assertEquals(expected, actual)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user