mapbox-java
                                
                                 mapbox-java copied to clipboard
                                
                                    mapbox-java copied to clipboard
                            
                            
                            
                        Index url path parameters from end to allow APIs to be nested under a path
Currently, the baseUrl needs to be 'only' a base URL.
This change will allow you to add a baseUrl with a path at the end without conflicting with the path parameters.
Passes all of the route options tests.
This can potentially break functionality for users who have additional path parameters appended after the coordinates. But I doubt anyone is doing that.
The convention is that the last path in a URL is the resource. So the last path ought to always be a coordinate. Also, coordinates are the most brittle value to be parsed. In this case, if you are using a non-standard base URL, user and profile are more likely to not have as much meaning.
The following test will fail:
    RouteOptions routeOptions = RouteOptions.fromUrl(new URL("https://api.mapbox.com/somepath/directions/v5/mapbox/driving-traffic/1.1,2.2;3.3,4.4?overview=full"));
    assertEquals("https://api.mapbox.com/somepath/", routeOptions.baseUrl());
with
Expected :https://api.mapbox.com/somepath/
Actual   :https://api.mapbox.com