From 64b06db74da3bb77c7bd703bf9124fed83c47d7f Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 9 Oct 2023 08:59:01 -0600 Subject: router/pathtree: support a required path segment prefix before :wildcards --- internal/pathtree_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal/pathtree_test.go') diff --git a/internal/pathtree_test.go b/internal/pathtree_test.go index e152e85..d9df757 100644 --- a/internal/pathtree_test.go +++ b/internal/pathtree_test.go @@ -34,6 +34,7 @@ func TestPathTree(t *testing.T) { {"/a/b", 3}, {"/c", 4}, {"/x/:y/z/*rest", 5}, + {"/f/prefix:y/z/*rest", 6}, }, paths: map[string]matchresult{ "/a": { @@ -66,6 +67,13 @@ func TestPathTree(t *testing.T) { "/": { failed: true, }, + "/f/mismatch/z/more": { + failed: true, + }, + "/f/prefixblargh/z/more": { + value: 6, + params: map[string]string{"y": "blargh", "rest": "more"}, + }, }, }, { -- cgit v1.2.3