Closed
Description
func TestAPIMatchAll(t *testing.T) {
domain1 := "baidu.com"
params := make(map[string][]byte, 0)
paramsFunc := func(name, value []byte) {
params[string(name)] = value
}
var id uint64
r := NewRoute()
r.Add(&metapb.API{
ID: 1,
MatchRule: metapb.MatchAll,
URLPattern: "/a/b/c",
Method: "POST",
Domain: domain1,
})
id, ret := r.Find([]byte("/a/b/d/c"), "POST", paramsFunc)
if !ret {
t.Fatal(ret)
return
}
if id != 1 {
t.Errorf("expect matched 1, but %d", id)
}
}
我理解的这个go test应该会失败,但是这个test pass了,所以这是一个bug,还是一个feature?
Metadata
Assignees
Labels
No labels