swifter
swifter copied to clipboard
'**' does not work with single path element
I've tried to use '' in a route, but it's not working when there is only a single path element. ie. /a//b matches /a/x/y/b but does not match /a/x/b. It appears to be the equivalent of >=2 path elements where I think it should be >= 1 path elements.
So if I modify the relevant unit test like this:
func testHttpRouterMultiplePathSegmentWildcards() {
router.register(nil, path: "/a/**/e/f/g", handler: { _ in
return .ok(.htmlBody("OK"))
})
XCTAssertNil(router.route(nil, path: "/"))
XCTAssertNil(router.route(nil, path: "/a"))
XCTAssertNotNil(router.route(nil, path: "/a/b/e/f/g")) // <- I would expect this to pass, but it fails.
XCTAssertNotNil(router.route(nil, path: "/a/b/c/d/e/f/g"))
XCTAssertNil(router.route(nil, path: "/a/e/f/g"))
}