We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
func TestFindMatchAmbiguity(t *testing.T) { r := NewRoute() r.Add(&metapb.API{ ID: 1, URLPattern: "/a/b/c", Method: "*", }) r.Add(&metapb.API{ ID: 2, URLPattern: "/(string):x/b/e", Method: "*", }) params := make(map[string]string, 0) paramsFunc := func(name, value []byte) { params[string(name)] = string(value) } id, _ := r.Find([]byte("/a/b/e"), "GET", paramsFunc) fmt.Println(id, params) }
输出: 0 map[]
0 map[]
预期是要匹配到api_id =2, 实际上匹配不了
The text was updated successfully, but these errors were encountered:
func TestFindMatchAmbiguity(t *testing.T) { r := NewRoute() r.Add(&metapb.API{ ID: 2, URLPattern: "/(string):x/b/e", Method: "*", }) params := make(map[string]string, 0) paramsFunc := func(name, value []byte) { params[string(name)] = string(value) } id, _ := r.Find([]byte("/a/b/e"), "GET", paramsFunc) fmt.Println(id, params) }
输出: 2 map[x:a]
2 map[x:a]
如果去掉api_id=1,才能匹配到结果
Sorry, something went wrong.
route的匹配算法只选了一个路径进行匹配,没有做错误回退处理,用深搜应该可以解决这个问题
No branches or pull requests
输出:
0 map[]
预期是要匹配到api_id =2, 实际上匹配不了
The text was updated successfully, but these errors were encountered: