Skip to content

Commit f519b6f

Browse files
Łukasz PaczosLukasPaczos
authored andcommitted
fixed Isochrone contours_meters required parameter count
Fixed an issue where Isochrone API's `contours_meters` required at least two input values, instead of only one.
1 parent df6742d commit f519b6f

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Mapbox welcomes participation and contributions from everyone.
44

55
### main
66

7+
- Fixed an issue where Isochrone API's `contours_meters` required at least two input values, instead of only one.
8+
79
### v7.3.0 - October 04, 2024
810

911
- Updated IsoChrone API to support new query parameters including contours_meters, road/route exclusions and departure time. [#1596](https://github.com/mapbox/mapbox-java/pull/1596)

services-isochrone/src/main/java/com/mapbox/api/isochrone/MapboxIsochrone.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ public MapboxIsochrone build() {
498498
+ " in order from the lowest number to the highest number.");
499499
}
500500
}
501-
contoursMeters(TextUtils.join(",", contoursMeters));
502501
}
502+
contoursMeters(TextUtils.join(",", contoursMeters));
503503
}
504504

505505
if (contoursColors != null) {

services-isochrone/src/test/java/com/mapbox/api/isochrone/MapboxIsochroneTest.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,38 @@ public void build_usingIntegerListForMinutes() throws ServicesException, IOExcep
155155
+ "36" + commaEquivalent + "52"));
156156
}
157157

158+
@Test
159+
public void build_usingIntegerListForMinutes_oneParam() throws ServicesException, IOException {
160+
MapboxIsochrone client = MapboxIsochrone.builder()
161+
.accessToken(ACCESS_TOKEN)
162+
.coordinates(testPoint)
163+
.addContoursMinutes(14)
164+
.profile(testProfile)
165+
.baseUrl(mockUrl.toString())
166+
.build();
167+
String requestUrlString = client.cloneCall().request().url().toString();
168+
169+
System.out.print(requestUrlString);
170+
171+
assertTrue(requestUrlString.contains("contours_minutes=14"));
172+
}
173+
174+
@Test
175+
public void build_usingIntegerListForMeters_oneParam() throws ServicesException, IOException {
176+
MapboxIsochrone client = MapboxIsochrone.builder()
177+
.accessToken(ACCESS_TOKEN)
178+
.coordinates(testPoint)
179+
.addContoursMeters(14)
180+
.profile(testProfile)
181+
.baseUrl(mockUrl.toString())
182+
.build();
183+
String requestUrlString = client.cloneCall().request().url().toString();
184+
185+
System.out.print(requestUrlString);
186+
187+
assertTrue(requestUrlString.contains("contours_meters=14"));
188+
}
189+
158190
@Test
159191
public void build_usingRawStringForMinutes() throws ServicesException, IOException {
160192

0 commit comments

Comments
 (0)