Skip to content

Commit f63beef

Browse files
committed
minor comments and formatting changes
1 parent 1197bb4 commit f63beef

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Sources/Router/OpenAPILambdaRouterTrie.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct URIPath: URIPathCollection {
101101
}
102102

103103
// search for each path component. If a component is not found, it might be a parameter
104+
// stop at the start of the query string
104105
let pathComponents = path.prefix(while: { $0 != "?" }).split(separator: "/")
105106
var currentNode = nodeHTTP
106107
for component in pathComponents {

Tests/OpenAPILambdaTests/Router/RouterGraphTest.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ struct RouterGraphTests {
323323

324324
//when
325325
#expect(throws: Never.self) { try graph.find(method: method, path: pathToTest) }
326-
let (handler, metadata) = try graph.find(method: method, path: pathToTest )
326+
let (handler, metadata) = try graph.find(method: method, path: pathToTest)
327327
#expect(metadata.count == 0)
328328
#expect(handler != nil)
329329
}
@@ -333,7 +333,7 @@ struct RouterGraphTests {
333333
arguments: [
334334
"/element3/value1/element4",
335335
"/element3/value2/element4",
336-
"/element3/value1/element4?param1=value1"
336+
"/element3/value1/element4?param1=value1",
337337
]
338338
)
339339
func testFindHandler2(
@@ -345,10 +345,14 @@ struct RouterGraphTests {
345345
let graph = prepareGraphForFind(for: method)
346346

347347
//when
348-
#expect(throws: Never.self) { try graph.find(method: method, path: pathToTest) }
349-
let (handler, metadata) = try graph.find(method: method, path: pathToTest)
350-
#expect(metadata.count == 1)
351-
#expect(handler != nil)
348+
#expect(throws: Never.self) {
349+
let (handler, metadata) = try graph.find(method: method, path: pathToTest)
350+
351+
// then (we can not test if the query string param have been decoded, that's the job of the openapi runtime.)
352+
#expect(metadata.count == 1)
353+
#expect(handler != nil)
354+
}
355+
352356
}
353357

354358
@Test("Find handler 3")

0 commit comments

Comments
 (0)