mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Transform request tiles for android

Open AryaNyx opened this issue 7 years ago • 1 comments

Hey. I'm using mapbox with my own tile server. I need to add header ( better approach ) or send parameter to url in each tile requests ( .pbf ). i have tried put my own token in Mapbox.getInstance(context , accessToken) with prefix ".pk" ( for ensure that pass the token validation method ) and i have seen that in other class ( HttpRequestUrl ) that make the provided request , mapbox uses another method to check the hostname should start with mapbox :

private static boolean isValidMapboxEndpoint(String host) { return host.equals("mapbox.com") || host.endsWith(".mapbox.com") || host.equals("mapbox.cn") || host.endsWith(".mapbox.cn"); }

So i couldn't send my token in tile request.

Is there any way to let me add header or send some parameters in url ?

Steps to reproduce

1.Add token in Mapbox.getInstance() 2. 3.

Expected behavior

Send puted token in each tile request.

Actual behavior

Nothing sent because of checking url to start with mapbox.

Configuration

**Android versions:8.0.0 **Device models:Xiaomi Mi Mix **Mapbox SDK versions: 8.0.0 ( latest version till now )

AryaNyx avatar May 25 '19 09:05 AryaNyx

two options: FileSource#setResourceTransform or use a custom OkHttpClient (on which you can interceptors) through HttpRequestUtils#setOkHttpClient.

tobrun avatar May 27 '19 06:05 tobrun