From 38c40a2ca0f70161b8a2110c2d387f0187198d7a Mon Sep 17 00:00:00 2001 From: udumft Date: Fri, 24 Feb 2023 11:01:03 +0300 Subject: [PATCH 1/2] vk-779-tolls-exclude-fix: correct cashTollOnly string value mistype --- Sources/MapboxDirections/RoadClasses.swift | 4 ++-- Tests/MapboxDirectionsTests/RouteOptionsTests.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/MapboxDirections/RoadClasses.swift b/Sources/MapboxDirections/RoadClasses.swift index 0bd211efd..81e19b8ce 100644 --- a/Sources/MapboxDirections/RoadClasses.swift +++ b/Sources/MapboxDirections/RoadClasses.swift @@ -121,7 +121,7 @@ public struct RoadClasses: OptionSet, CustomStringConvertible { roadClasses.insert(.highOccupancyToll) case "unpaved": roadClasses.insert(.unpaved) - case "cash_only_toll": + case "cash_only_tolls": roadClasses.insert(.cashTollOnly) case "": continue @@ -162,7 +162,7 @@ public struct RoadClasses: OptionSet, CustomStringConvertible { descriptions.append("unpaved") } if contains(.cashTollOnly) { - descriptions.append("cash_only_toll") + descriptions.append("cash_only_tolls") } return descriptions.joined(separator: ",") } diff --git a/Tests/MapboxDirectionsTests/RouteOptionsTests.swift b/Tests/MapboxDirectionsTests/RouteOptionsTests.swift index fb4d8951a..bc3d9ea91 100644 --- a/Tests/MapboxDirectionsTests/RouteOptionsTests.swift +++ b/Tests/MapboxDirectionsTests/RouteOptionsTests.swift @@ -357,7 +357,7 @@ class RouteOptionsTests: XCTestCase { options.roadClassesToAvoid = [.toll, .motorway, .ferry, .unpaved, .cashTollOnly] options.roadClassesToAllow = [.highOccupancyVehicle2, .highOccupancyVehicle3, .highOccupancyToll] - let expectedExcludeQueryItem = URLQueryItem(name: "exclude", value: "toll,motorway,ferry,unpaved,cash_only_toll") + let expectedExcludeQueryItem = URLQueryItem(name: "exclude", value: "toll,motorway,ferry,unpaved,cash_only_tolls") XCTAssertTrue(options.urlQueryItems.contains(expectedExcludeQueryItem)) let expectedIncludeQueryItem = URLQueryItem(name: "include", value: "hov2,hov3,hot") From 22379a16c3614647c296e8d2400b751138ba3123 Mon Sep 17 00:00:00 2001 From: udumft Date: Fri, 24 Feb 2023 11:06:16 +0300 Subject: [PATCH 2/2] vk-779-tolls-exclude-fix: CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12e93ecb9..9e874bf59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Added `Matrix` API wrapper. The [Mapbox Matrix API](https://docs.mapbox.com/api/navigation/matrix/) computes travel times between many points, and returns a matrix of all travel times between the locations. [#626](https://github.com/mapbox/mapbox-directions-swift/pull/626) * Fixed a crash that could occur if only one `Waypoint` with a nonnull `name` was used in the Directions request. [#797](https://github.com/mapbox/mapbox-directions-swift/pull/797) * Added `Interchange` and `Junction` structs describing IC and JCT. [#799](https://github.com/mapbox/mapbox-directions-swift/pull/799) +* Fixed an issue where using `cashTollOnly` for road class exclusions failed the directions request. ([#801](https://github.com/mapbox/mapbox-directions-swift/pull/801)) ## v2.9.0