Environment
- Android OS version: all
- Devices affected: all
- Maps SDK Version: com.mapbox.maps:android-ndk27:11.25.0
Observed behavior and steps to reproduce
I need to set a custom user agent on Mapbox tile requests. I have code that looks like this. Note that the user agent that is set via "User-Agent" is ignored; one must use the incorrect "user-agent" as the header name.
HttpServiceFactory.setHttpServiceInterceptor(object : HttpServiceInterceptorInterface {
override fun onRequest(
request: HttpRequest,
continuation: HttpServiceInterceptorRequestContinuation
) {
// Set user agent on requests; some servers check this
request.headers["User-Agent"] = NetworkUtils.USER_AGENT_STRING
// TODO: Mapbox incorrectly uses the header in lowercase. Remove when fixed in Mapbox.
request.headers["user-agent"] = NetworkUtils.USER_AGENT_STRING
continuation.run(HttpRequestOrResponse(request))
}
This worked in previous versions of Mapbox but broke sometime in the last year or two.
Expected behavior
Here is the RFC that documents that the correct name of the header is "User-Agent" (capitalized).
https://httpwg.org/specs/rfc9110.html#field.user-agent
The iOS Mapbox library uses the correct "User-Agent".
Environment
Observed behavior and steps to reproduce
I need to set a custom user agent on Mapbox tile requests. I have code that looks like this. Note that the user agent that is set via "User-Agent" is ignored; one must use the incorrect "user-agent" as the header name.
This worked in previous versions of Mapbox but broke sometime in the last year or two.
Expected behavior
Here is the RFC that documents that the correct name of the header is "User-Agent" (capitalized).
https://httpwg.org/specs/rfc9110.html#field.user-agent
The iOS Mapbox library uses the correct "User-Agent".