Skip to content

Commit

Permalink
Merge pull request #76 from cecileprat/master
Browse files Browse the repository at this point in the history
Fix route v8 multiple via points
  • Loading branch information
abdullahselek authored Mar 31, 2024
2 parents 18c1512 + 5ac00a6 commit 5e6b9ac
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion herepy/routing_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def route_v8(
via_keys = []
if via:
for i, v in enumerate(via):
key = str.format("{0}{1}", "via", i)
key = str.format("{0}{1}_", "via", i)
via_keys.append(key)
data[key] = str.format("{0},{1}", v[0], v[1])
if departure_time:
Expand Down
22 changes: 22 additions & 0 deletions tests/test_routing_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,3 +1179,25 @@ def test_route_v8_error_access_denied(self):
truck={"shippedHazardousGoods": ["explosive", "gas"]},
scooter={"allowHighway": "true"},
)

@responses.activate
def test_route_v8_multiple_via_points(self):
responses.add(
responses.GET,
"https://router.hereapi.com/v8/routes",
"{}",
status=200,
match=[
responses.matchers.query_param_matcher(
{"via": ["41.9339,-87.9021"] * 11}, strict_match=False
)
],
)
response = self._api.route_v8(
transport_mode=herepy.RoutingTransportMode.car,
origin=[41.9798, -87.8801],
destination=[41.9043, -87.9216],
via=[[41.9339, -87.9021]] * 11,
)
self.assertTrue(response)
self.assertIsInstance(response, herepy.RoutingResponseV8)

0 comments on commit 5e6b9ac

Please sign in to comment.