Skip to content
New issue

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

Route.Find match error #225

Closed
SuperGod opened this issue Jun 29, 2021 · 0 comments
Closed

Route.Find match error #225

SuperGod opened this issue Jun 29, 2021 · 0 comments

Comments

@SuperGod
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant