Skip to content

Incorrect TSR with mixed static and wildcard paths #2918

Closed
@ibraheemdev

Description

The backtracking logic in #2897 is causing incorrect TSR values:

func TestTreeBacktrackingTsr(t *testing.T) {
	tree := &node{}
	tree.addRoute("/api/:page/:name", fakeHandler("1"))
	tree.addRoute("/api/hello/:name/bar/", fakeHandler("1"))
	res := tree.getValue("/api/hello/x/bar", getParams(), getSkippedNodes(), false)
	if res.tsr != true {
		t.Fatalf("expected tsr")
	}
}
--- FAIL: TestTreeBacktrackingTsr (0.00s)
    tree_test.go:855: expected tsr

I believe the TSR would have to be checked before backtracking.

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