-
Notifications
You must be signed in to change notification settings - Fork 245
Closed
Labels
Description
Currently there isn't a way to add custom request headers in HttpHandler subclasses because the underlying http client is private. The Android SDK will need this ability when implementing mapzen/android#382 and EM relies on the ability to customize headers when adding the "do not track" header https://github.com/mapzen/eraser-map/blob/master/app/src/main/kotlin/com/mapzen/erasermap/model/TileHttpHandler.kt#L19
I propose adding a header Map parameter to onRequest and updating the implementation to construct a Request using this map:
public boolean onRequest(String url, Map<String, String> headers, Callback cb) {
Request request = new Request.Builder()
.url(url)
.headers(Headers.of(headers))
.build();
okClient.newCall(request).enqueue(cb);
return true;
}