From 7955cf8c89b94b7b5dd4e5115b05abc73b3b8074 Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 5 Mar 2024 09:50:31 +0100 Subject: [PATCH 01/10] Add support for query parameters in the PathConfiguration --- Source/Path Configuration/PathConfiguration.swift | 12 +++++------- Tests/Fixtures/test-configuration.json | 4 ++++ Tests/PathConfigurationLoaderTests.swift | 4 ++-- Tests/PathConfigurationTests.swift | 12 ++++++++++-- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Source/Path Configuration/PathConfiguration.swift b/Source/Path Configuration/PathConfiguration.swift index 8c4a3c0..6f37cae 100644 --- a/Source/Path Configuration/PathConfiguration.swift +++ b/Source/Path Configuration/PathConfiguration.swift @@ -52,13 +52,11 @@ public final class PathConfiguration { properties(for: url) } - /// Returns a merged dictionary containing all the properties - /// that match this url - /// Note: currently only looks at path, not query, but most likely will - /// add query support in the future, so it's best to always use this over the path variant - /// unless you're sure you'll never need to reference other parts of the URL in the future - public func properties(for url: URL) -> PathProperties { - properties(for: url.path) + /// Returns a merged dictionary containing all the properties that match this url + /// Note: by default we consider both the path and the query parameters of the URL + public func properties(for url: URL, considerParams: Bool = true) -> PathProperties { + let path = considerParams ? url.path + (url.query.map { "?" + $0 } ?? "") : url.path + return properties(for: path) } /// Returns a merged dictionary containing all the properties diff --git a/Tests/Fixtures/test-configuration.json b/Tests/Fixtures/test-configuration.json index e0d050a..334c20a 100644 --- a/Tests/Fixtures/test-configuration.json +++ b/Tests/Fixtures/test-configuration.json @@ -19,6 +19,10 @@ { "patterns": ["/edit$"], "properties": {"background_color": "white"} + }, + { + "patterns": [".*\\?open_in_external_browser=true.*"], + "properties": {"open_in_external_browser": true} } ] } diff --git a/Tests/PathConfigurationLoaderTests.swift b/Tests/PathConfigurationLoaderTests.swift index e04956d..ffa1148 100644 --- a/Tests/PathConfigurationLoaderTests.swift +++ b/Tests/PathConfigurationLoaderTests.swift @@ -15,7 +15,7 @@ class PathConfigurationLoaderTests: XCTestCase { loader.load { loadedConfig = $0 } let config = try XCTUnwrap(loadedConfig) - XCTAssertEqual(config.rules.count, 4) + XCTAssertEqual(config.rules.count, 5) } func test_file_automaticallyLoadsFromTheLocalFileAndCallsTheHandler() throws { @@ -25,7 +25,7 @@ class PathConfigurationLoaderTests: XCTestCase { loader.load { loadedConfig = $0 } let config = try XCTUnwrap(loadedConfig) - XCTAssertEqual(config.rules.count, 4) + XCTAssertEqual(config.rules.count, 5) } func test_server_automaticallyDownloadsTheFileAndCallsTheHandler() throws { diff --git a/Tests/PathConfigurationTests.swift b/Tests/PathConfigurationTests.swift index 5a45e83..63b0de4 100644 --- a/Tests/PathConfigurationTests.swift +++ b/Tests/PathConfigurationTests.swift @@ -12,7 +12,7 @@ class PathConfigurationTests: XCTestCase { func test_init_automaticallyLoadsTheConfigurationFromTheSpecifiedLocation() { XCTAssertEqual(configuration.settings.count, 2) - XCTAssertEqual(configuration.rules.count, 4) + XCTAssertEqual(configuration.rules.count, 5) } func test_settings_returnsCurrentSettings() { @@ -39,6 +39,13 @@ class PathConfigurationTests: XCTestCase { "background_color": "white" ]) } + + func test_propertiesForURL_withParams() { + let url = URL(string: "http://turbo.test/sample.pdf?open_in_external_browser=true")! + XCTAssertEqual(configuration.properties(for: url), [ + "open_in_external_browser": true + ]) + } func test_propertiesForPath_whenNoMatch_returnsEmptyProperties() { XCTAssertEqual(configuration.properties(for: "/missing"), [:]) @@ -49,6 +56,7 @@ class PathConfigurationTests: XCTestCase { XCTAssertEqual(configuration.properties(for: "/edit"), configuration["/edit"]) XCTAssertEqual(configuration.properties(for: "/"), configuration["/"]) XCTAssertEqual(configuration.properties(for: "/missing"), configuration["/missing"]) + XCTAssertEqual(configuration.properties(for: "/sample.pdf?open_in_external_browser=true"), configuration["/sample.pdf?open_in_external_browser=true"]) } } @@ -61,7 +69,7 @@ class PathConfigTests: XCTestCase { let config = try PathConfigurationDecoder(json: json) XCTAssertEqual(config.settings.count, 2) - XCTAssertEqual(config.rules.count, 4) + XCTAssertEqual(config.rules.count, 5) } func test_json_withMissingRulesKey_failsToDecode() throws { From b3f22cfc3aaf84db4603286a5f08a35809b61073 Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Tue, 5 Mar 2024 09:10:44 -0800 Subject: [PATCH 02/10] Default param matching to false and add assertion --- Source/Path Configuration/PathConfiguration.swift | 15 +++++++++------ Tests/Fixtures/test-configuration.json | 2 +- Tests/PathConfigurationTests.swift | 5 ++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Source/Path Configuration/PathConfiguration.swift b/Source/Path Configuration/PathConfiguration.swift index 6f37cae..3d9985b 100644 --- a/Source/Path Configuration/PathConfiguration.swift +++ b/Source/Path Configuration/PathConfiguration.swift @@ -51,12 +51,15 @@ public final class PathConfiguration { public subscript(url: URL) -> PathProperties { properties(for: url) } - - /// Returns a merged dictionary containing all the properties that match this url - /// Note: by default we consider both the path and the query parameters of the URL - public func properties(for url: URL, considerParams: Bool = true) -> PathProperties { - let path = considerParams ? url.path + (url.query.map { "?" + $0 } ?? "") : url.path - return properties(for: path) + + /// Returns a merged dictionary containing all the properties that match this URL. + /// - Parameters: + /// - considerParams: Enable to include query items when matching URLs. + public func properties(for url: URL, considerParams: Bool = false) -> PathProperties { + if considerParams, let query = url.query { + return properties(for: "\(url.path)?\(query)") + } + return properties(for: url.path) } /// Returns a merged dictionary containing all the properties diff --git a/Tests/Fixtures/test-configuration.json b/Tests/Fixtures/test-configuration.json index 334c20a..c957183 100644 --- a/Tests/Fixtures/test-configuration.json +++ b/Tests/Fixtures/test-configuration.json @@ -21,7 +21,7 @@ "properties": {"background_color": "white"} }, { - "patterns": [".*\\?open_in_external_browser=true.*"], + "patterns": [".*\\?.*open_in_external_browser=true.*"], "properties": {"open_in_external_browser": true} } ] diff --git a/Tests/PathConfigurationTests.swift b/Tests/PathConfigurationTests.swift index 63b0de4..4b92cad 100644 --- a/Tests/PathConfigurationTests.swift +++ b/Tests/PathConfigurationTests.swift @@ -42,7 +42,10 @@ class PathConfigurationTests: XCTestCase { func test_propertiesForURL_withParams() { let url = URL(string: "http://turbo.test/sample.pdf?open_in_external_browser=true")! - XCTAssertEqual(configuration.properties(for: url), [ + + XCTAssertEqual(configuration.properties(for: url), [:]) + + XCTAssertEqual(configuration.properties(for: url, considerParams: true), [ "open_in_external_browser": true ]) } From 85d81c046f47adae711606fd541df17670aa58cd Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Tue, 5 Mar 2024 09:17:09 -0800 Subject: [PATCH 03/10] Add documentation on new matching rule --- Docs/PathConfiguration.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Docs/PathConfiguration.md b/Docs/PathConfiguration.md index 94b23c7..b106556 100644 --- a/Docs/PathConfiguration.md +++ b/Docs/PathConfiguration.md @@ -61,7 +61,7 @@ let pathConfiguration = PathConfiguration(sources: [ Path properties are the core of the path configuration. The `rules` key of the JSON is an array of dictionaries. Each dictionary has a `patterns` array which is an array of regular expressions for matching on the URL, and a dictionary of `properties` that will get returned when a pattern matches. -You can lookup the properties for a URL by using the URL itself or the `url.path` value. Currently, the path configuration only looks at the path component of the URL, but likely we'll add support for other components in the future. The path configuration finds all matching rules in order, and then merges them into one dictionary, with later rules overriding earlier ones. This way you can group similar properties together. +You can lookup the properties for a URL by using the URL itself or the `url.path` value. The path configuration finds all matching rules in order, and then merges them into one dictionary, with later rules overriding earlier ones. This way you can group similar properties together. Given the following rules: @@ -106,6 +106,25 @@ The url `example.com/messages/new` however would match both the first and second When the `Session` proposes a visit, it looks up the path properties for the proposed visit url if it has a `pathConfiguration` and it passes those path properties to your app in the `VisitProposal` via `proposal.properties`. This is for convenience, but you can also use the path configuration directly and do the same lookup in your application code. +### Matching the Query + +By default, the path configuration only looks at the path component of the URL. You can also include the query when matching with the following: + +```swift +pathConfiguration.properties(for: url, considerParams: true) +``` + +To ensure the order of query items don't effect matching, a wildcard `.*` before and after the match is recommended, like so: + +``` +{ + "patterns": [".*\\?.*foo=bar.*"], + "properties": { + "foo": "bar" + } +} +``` + ## Settings The path configuration optionally can have a top-level `settings` dictionary. This can be whatever data you want. We use it for controlling anything that we want the flexibility to change from the server without releasing an update. This might be different urls, configurations, feature flags, etc. If you don't want to use that, you can omit it entirely from the JSON. From c0d25d6b6e81caed56ffd382c407792811f07475 Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Tue, 5 Mar 2024 09:27:18 -0800 Subject: [PATCH 04/10] Make option explicit and add global configuration --- Docs/PathConfiguration.md | 8 +++++++- Source/Path Configuration/PathConfiguration.swift | 8 ++++---- Source/Session/Session.swift | 2 +- Source/Turbo.swift | 13 +++++++++++++ Tests/PathConfigurationTests.swift | 4 ++-- 5 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 Source/Turbo.swift diff --git a/Docs/PathConfiguration.md b/Docs/PathConfiguration.md index b106556..1a89f99 100644 --- a/Docs/PathConfiguration.md +++ b/Docs/PathConfiguration.md @@ -111,7 +111,13 @@ When the `Session` proposes a visit, it looks up the path properties for the pro By default, the path configuration only looks at the path component of the URL. You can also include the query when matching with the following: ```swift -pathConfiguration.properties(for: url, considerParams: true) +pathConfiguration.properties(for: url, matchQuery: true) +``` + +Or, globally enable query matching via: + +```swift +Turbo.config.matchPathConfigurationQuery = true ``` To ensure the order of query items don't effect matching, a wildcard `.*` before and after the match is recommended, like so: diff --git a/Source/Path Configuration/PathConfiguration.swift b/Source/Path Configuration/PathConfiguration.swift index 3d9985b..79d9357 100644 --- a/Source/Path Configuration/PathConfiguration.swift +++ b/Source/Path Configuration/PathConfiguration.swift @@ -49,14 +49,14 @@ public final class PathConfiguration { /// Convenience method for retrieving properties for url: configuration[url] public subscript(url: URL) -> PathProperties { - properties(for: url) + properties(for: url, matchQuery: Turbo.config.matchPathConfigurationQuery) } /// Returns a merged dictionary containing all the properties that match this URL. /// - Parameters: - /// - considerParams: Enable to include query items when matching URLs. - public func properties(for url: URL, considerParams: Bool = false) -> PathProperties { - if considerParams, let query = url.query { + /// - matchQuery: Enable to include query items when matching URLs. + public func properties(for url: URL, matchQuery: Bool) -> PathProperties { + if matchQuery, let query = url.query { return properties(for: "\(url.path)?\(query)") } return properties(for: url.path) diff --git a/Source/Session/Session.swift b/Source/Session/Session.swift index 0831b27..7cbb766 100644 --- a/Source/Session/Session.swift +++ b/Source/Session/Session.swift @@ -282,7 +282,7 @@ extension Session: VisitableDelegate { extension Session: WebViewDelegate { func webView(_ bridge: WebViewBridge, didProposeVisitToLocation location: URL, options: VisitOptions) { - let properties = pathConfiguration?.properties(for: location) ?? [:] + let properties = pathConfiguration?.properties(for: location, matchQuery: Turbo.config.matchPathConfigurationQuery) ?? [:] let proposal = VisitProposal(url: location, options: options, properties: properties) delegate?.session(self, didProposeVisit: proposal) } diff --git a/Source/Turbo.swift b/Source/Turbo.swift new file mode 100644 index 0000000..e6a1e5f --- /dev/null +++ b/Source/Turbo.swift @@ -0,0 +1,13 @@ +public enum Turbo { + public static var config = TurboConfig() +} + +public class TurboConfig { + public var debugLoggingEnabled = false { + didSet { + TurboLog.debugLoggingEnabled = debugLoggingEnabled + } + } + + public var matchPathConfigurationQuery = false +} diff --git a/Tests/PathConfigurationTests.swift b/Tests/PathConfigurationTests.swift index 4b92cad..a254194 100644 --- a/Tests/PathConfigurationTests.swift +++ b/Tests/PathConfigurationTests.swift @@ -43,9 +43,9 @@ class PathConfigurationTests: XCTestCase { func test_propertiesForURL_withParams() { let url = URL(string: "http://turbo.test/sample.pdf?open_in_external_browser=true")! - XCTAssertEqual(configuration.properties(for: url), [:]) + XCTAssertEqual(configuration.properties(for: url, matchQuery: false), [:]) - XCTAssertEqual(configuration.properties(for: url, considerParams: true), [ + XCTAssertEqual(configuration.properties(for: url, matchQuery: true), [ "open_in_external_browser": true ]) } From 4d6c8df45a9c8f63e5f4bfd8b94f9a8553cd7c7b Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Wed, 13 Mar 2024 15:39:48 -0700 Subject: [PATCH 05/10] Configure path matching via global config, only --- Docs/PathConfiguration.md | 10 ++-------- Source/Path Configuration/PathConfiguration.swift | 6 +++--- Source/Session/Session.swift | 2 +- Source/Turbo.swift | 8 +++++++- Tests/PathConfigurationTests.swift | 6 ++++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Docs/PathConfiguration.md b/Docs/PathConfiguration.md index 1a89f99..8ee55d3 100644 --- a/Docs/PathConfiguration.md +++ b/Docs/PathConfiguration.md @@ -108,16 +108,10 @@ When the `Session` proposes a visit, it looks up the path properties for the pro ### Matching the Query -By default, the path configuration only looks at the path component of the URL. You can also include the query when matching with the following: +By default, the path configuration only looks at the path component of the URL. Enable query matching via: ```swift -pathConfiguration.properties(for: url, matchQuery: true) -``` - -Or, globally enable query matching via: - -```swift -Turbo.config.matchPathConfigurationQuery = true +Turbo.config.pathConfiguration.matchQuery = true ``` To ensure the order of query items don't effect matching, a wildcard `.*` before and after the match is recommended, like so: diff --git a/Source/Path Configuration/PathConfiguration.swift b/Source/Path Configuration/PathConfiguration.swift index 79d9357..523be7b 100644 --- a/Source/Path Configuration/PathConfiguration.swift +++ b/Source/Path Configuration/PathConfiguration.swift @@ -49,14 +49,14 @@ public final class PathConfiguration { /// Convenience method for retrieving properties for url: configuration[url] public subscript(url: URL) -> PathProperties { - properties(for: url, matchQuery: Turbo.config.matchPathConfigurationQuery) + properties(for: url) } /// Returns a merged dictionary containing all the properties that match this URL. /// - Parameters: /// - matchQuery: Enable to include query items when matching URLs. - public func properties(for url: URL, matchQuery: Bool) -> PathProperties { - if matchQuery, let query = url.query { + public func properties(for url: URL) -> PathProperties { + if Turbo.config.pathConfiguration.matchQuery, let query = url.query { return properties(for: "\(url.path)?\(query)") } return properties(for: url.path) diff --git a/Source/Session/Session.swift b/Source/Session/Session.swift index 7cbb766..0831b27 100644 --- a/Source/Session/Session.swift +++ b/Source/Session/Session.swift @@ -282,7 +282,7 @@ extension Session: VisitableDelegate { extension Session: WebViewDelegate { func webView(_ bridge: WebViewBridge, didProposeVisitToLocation location: URL, options: VisitOptions) { - let properties = pathConfiguration?.properties(for: location, matchQuery: Turbo.config.matchPathConfigurationQuery) ?? [:] + let properties = pathConfiguration?.properties(for: location) ?? [:] let proposal = VisitProposal(url: location, options: options, properties: properties) delegate?.session(self, didProposeVisit: proposal) } diff --git a/Source/Turbo.swift b/Source/Turbo.swift index e6a1e5f..b05d675 100644 --- a/Source/Turbo.swift +++ b/Source/Turbo.swift @@ -9,5 +9,11 @@ public class TurboConfig { } } - public var matchPathConfigurationQuery = false + public var pathConfiguration = PathConfiguration() +} + +public extension TurboConfig { + class PathConfiguration { + public var matchQuery = false + } } diff --git a/Tests/PathConfigurationTests.swift b/Tests/PathConfigurationTests.swift index a254194..92e5882 100644 --- a/Tests/PathConfigurationTests.swift +++ b/Tests/PathConfigurationTests.swift @@ -43,9 +43,11 @@ class PathConfigurationTests: XCTestCase { func test_propertiesForURL_withParams() { let url = URL(string: "http://turbo.test/sample.pdf?open_in_external_browser=true")! - XCTAssertEqual(configuration.properties(for: url, matchQuery: false), [:]) + Turbo.config.pathConfiguration.matchQuery = false + XCTAssertEqual(configuration.properties(for: url), [:]) - XCTAssertEqual(configuration.properties(for: url, matchQuery: true), [ + Turbo.config.pathConfiguration.matchQuery = true + XCTAssertEqual(configuration.properties(for: url), [ "open_in_external_browser": true ]) } From b637c14a097fe0747da63774c96fb9d646126d26 Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Wed, 13 Mar 2024 15:43:05 -0700 Subject: [PATCH 06/10] Remove unused parameter documentation --- Source/Path Configuration/PathConfiguration.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/Path Configuration/PathConfiguration.swift b/Source/Path Configuration/PathConfiguration.swift index 523be7b..b41ac16 100644 --- a/Source/Path Configuration/PathConfiguration.swift +++ b/Source/Path Configuration/PathConfiguration.swift @@ -53,8 +53,6 @@ public final class PathConfiguration { } /// Returns a merged dictionary containing all the properties that match this URL. - /// - Parameters: - /// - matchQuery: Enable to include query items when matching URLs. public func properties(for url: URL) -> PathProperties { if Turbo.config.pathConfiguration.matchQuery, let query = url.query { return properties(for: "\(url.path)?\(query)") From 8be17668be1fbb5ef7874e14fa088ee981375fe5 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Fri, 22 Mar 2024 16:44:19 -0400 Subject: [PATCH 07/10] Update Docs/PathConfiguration.md with query string config --- Docs/PathConfiguration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/PathConfiguration.md b/Docs/PathConfiguration.md index 8ee55d3..905d696 100644 --- a/Docs/PathConfiguration.md +++ b/Docs/PathConfiguration.md @@ -106,7 +106,7 @@ The url `example.com/messages/new` however would match both the first and second When the `Session` proposes a visit, it looks up the path properties for the proposed visit url if it has a `pathConfiguration` and it passes those path properties to your app in the `VisitProposal` via `proposal.properties`. This is for convenience, but you can also use the path configuration directly and do the same lookup in your application code. -### Matching the Query +### Query String Matching By default, the path configuration only looks at the path component of the URL. Enable query matching via: From fc14abab45cc9b2bb3adfbaaf37478a549054276 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Fri, 22 Mar 2024 16:44:44 -0400 Subject: [PATCH 08/10] Update Docs/PathConfiguration.md with query string config --- Docs/PathConfiguration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/PathConfiguration.md b/Docs/PathConfiguration.md index 905d696..936e606 100644 --- a/Docs/PathConfiguration.md +++ b/Docs/PathConfiguration.md @@ -108,7 +108,7 @@ When the `Session` proposes a visit, it looks up the path properties for the pro ### Query String Matching -By default, the path configuration only looks at the path component of the URL. Enable query matching via: +By default, path patterns only match against the path component of the URL. Enable query string matching via: ```swift Turbo.config.pathConfiguration.matchQuery = true From 29414c53bf50796f0ce6e6db8eb68962455e3493 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Fri, 22 Mar 2024 16:45:31 -0400 Subject: [PATCH 09/10] Update Docs/PathConfiguration.md with query string config --- Docs/PathConfiguration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/PathConfiguration.md b/Docs/PathConfiguration.md index 936e606..1f743c2 100644 --- a/Docs/PathConfiguration.md +++ b/Docs/PathConfiguration.md @@ -114,7 +114,7 @@ By default, path patterns only match against the path component of the URL. Enab Turbo.config.pathConfiguration.matchQuery = true ``` -To ensure the order of query items don't effect matching, a wildcard `.*` before and after the match is recommended, like so: +To ensure the order of query string parameters don't affect matching, a wildcard `.*` before and after the match is recommended, like so: ``` { From c961266195ff98a060f0e67dd0e30d11c9b557b1 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Fri, 22 Mar 2024 16:54:21 -0400 Subject: [PATCH 10/10] Change config option from matchQuery -> matchQueryStrings --- Docs/PathConfiguration.md | 2 +- Source/Path Configuration/PathConfiguration.swift | 2 +- Source/Turbo.swift | 2 +- Tests/PathConfigurationTests.swift | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Docs/PathConfiguration.md b/Docs/PathConfiguration.md index 1f743c2..7046fad 100644 --- a/Docs/PathConfiguration.md +++ b/Docs/PathConfiguration.md @@ -111,7 +111,7 @@ When the `Session` proposes a visit, it looks up the path properties for the pro By default, path patterns only match against the path component of the URL. Enable query string matching via: ```swift -Turbo.config.pathConfiguration.matchQuery = true +Turbo.config.pathConfiguration.matchQueryStrings = true ``` To ensure the order of query string parameters don't affect matching, a wildcard `.*` before and after the match is recommended, like so: diff --git a/Source/Path Configuration/PathConfiguration.swift b/Source/Path Configuration/PathConfiguration.swift index b41ac16..a957b69 100644 --- a/Source/Path Configuration/PathConfiguration.swift +++ b/Source/Path Configuration/PathConfiguration.swift @@ -54,7 +54,7 @@ public final class PathConfiguration { /// Returns a merged dictionary containing all the properties that match this URL. public func properties(for url: URL) -> PathProperties { - if Turbo.config.pathConfiguration.matchQuery, let query = url.query { + if Turbo.config.pathConfiguration.matchQueryStrings, let query = url.query { return properties(for: "\(url.path)?\(query)") } return properties(for: url.path) diff --git a/Source/Turbo.swift b/Source/Turbo.swift index b05d675..cd388c8 100644 --- a/Source/Turbo.swift +++ b/Source/Turbo.swift @@ -14,6 +14,6 @@ public class TurboConfig { public extension TurboConfig { class PathConfiguration { - public var matchQuery = false + public var matchQueryStrings = false } } diff --git a/Tests/PathConfigurationTests.swift b/Tests/PathConfigurationTests.swift index 92e5882..be702ea 100644 --- a/Tests/PathConfigurationTests.swift +++ b/Tests/PathConfigurationTests.swift @@ -43,10 +43,10 @@ class PathConfigurationTests: XCTestCase { func test_propertiesForURL_withParams() { let url = URL(string: "http://turbo.test/sample.pdf?open_in_external_browser=true")! - Turbo.config.pathConfiguration.matchQuery = false + Turbo.config.pathConfiguration.matchQueryStrings = false XCTAssertEqual(configuration.properties(for: url), [:]) - Turbo.config.pathConfiguration.matchQuery = true + Turbo.config.pathConfiguration.matchQueryStrings = true XCTAssertEqual(configuration.properties(for: url), [ "open_in_external_browser": true ])