Skip to content

'**' does not work with single path element  #488

@drekka

Description

@drekka

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"))
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions