MCPcopy Create free account
hub / github.com/BryanMwangi/pine / TestRouter_MultipleParams

Function TestRouter_MultipleParams

router_test.go:73–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func TestRouter_MultipleParams(t *testing.T) {
74 r := newTestRouter()
75 r.Insert("GET", "/user/:id/post/:postId", []Handler{func(c *Ctx) error { return nil }})
76
77 _, params, found := r.Search("GET", "/user/7/post/99")
78 if !found {
79 t.Fatal("expected match")
80 }
81 if params["id"] != "7" {
82 t.Errorf("expected id=7, got %q", params["id"])
83 }
84 if params["postId"] != "99" {
85 t.Errorf("expected postId=99, got %q", params["postId"])
86 }
87}
88
89func TestRouter_DeepNesting(t *testing.T) {
90 r := newTestRouter()

Callers

nothing calls this directly

Calls 3

newTestRouterFunction · 0.85
InsertMethod · 0.80
SearchMethod · 0.80

Tested by

no test coverage detected