From 01e7d81883b1f6bc06c8b178e92cb3e7bb4c5979 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 25 May 2023 15:14:03 +0300 Subject: [PATCH] tmp Signed-off-by: Vasiliy Tolstov --- meter/wrapper/wrapper.go | 4 ---- util/http/trie_test.go | 25 +++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/meter/wrapper/wrapper.go b/meter/wrapper/wrapper.go index 8bb48e02..33634da2 100644 --- a/meter/wrapper/wrapper.go +++ b/meter/wrapper/wrapper.go @@ -196,10 +196,6 @@ func (w *wrapper) Stream(ctx context.Context, req client.Request, opts ...client return stream, err } -func (w *wrapper) Publish(ctx context.Context, p client.Message, opts ...client.PublishOption) error { - return w.Client.Publish(ctx, p, opts...) -} - // NewServerHandlerWrapper create new server handler wrapper func NewServerHandlerWrapper(opts ...Option) server.HandlerWrapper { handler := &wrapper{ diff --git a/util/http/trie_test.go b/util/http/trie_test.go index 0dd58c81..0b7f94f8 100644 --- a/util/http/trie_test.go +++ b/util/http/trie_test.go @@ -5,8 +5,29 @@ import ( "testing" ) -func TestTrieBackwards(t *testing.T) { - _ = &Trie{} +func TestTrieWithDot(t *testing.T) { + var err error + type handler struct { + name string + } + + tr := NewTrie() + if err = tr.Insert([]string{http.MethodGet}, "/*", &handler{name: "slash_astar"}); err != nil { + t.Fatal(err) + } + if err = tr.Insert([]string{http.MethodGet}, "*", &handler{name: "astar"}); err != nil { + t.Fatal(err) + } + if err = tr.Insert([]string{http.MethodGet}, "/.well-known/test", &handler{name: "well-known"}); err != nil { + t.Fatal(err) + } + h, _, err := tr.Search(http.MethodGet, "/.well-known/test") + if err != nil { + t.Fatalf("unexpected error handler not found") + } + if h.(*handler).name != "well-known" { + t.Fatalf("error matching route with wildcard") + } } func TestTrieWildcardPathPrefix(t *testing.T) {