(t *testing.T)
| 1651 | } |
| 1652 | |
| 1653 | func TestMuxSubrouterWildcardParam(t *testing.T) { |
| 1654 | h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 1655 | fmt.Fprintf(w, "param:%v *:%v", URLParam(r, "param"), URLParam(r, "*")) |
| 1656 | }) |
| 1657 | |
| 1658 | r := NewRouter() |
| 1659 | |
| 1660 | r.Get("/bare/{param}", h) |
| 1661 | r.Get("/bare/{param}/*", h) |
| 1662 | |
| 1663 | r.Route("/case0", func(r Router) { |
| 1664 | r.Get("/{param}", h) |
| 1665 | r.Get("/{param}/*", h) |
| 1666 | }) |
| 1667 | |
| 1668 | ts := httptest.NewServer(r) |
| 1669 | defer ts.Close() |
| 1670 | |
| 1671 | if _, body := testRequest(t, ts, "GET", "/bare/hi", nil); body != "param:hi *:" { |
| 1672 | t.Fatal(body) |
| 1673 | } |
| 1674 | if _, body := testRequest(t, ts, "GET", "/bare/hi/yes", nil); body != "param:hi *:yes" { |
| 1675 | t.Fatal(body) |
| 1676 | } |
| 1677 | if _, body := testRequest(t, ts, "GET", "/case0/hi", nil); body != "param:hi *:" { |
| 1678 | t.Fatal(body) |
| 1679 | } |
| 1680 | if _, body := testRequest(t, ts, "GET", "/case0/hi/yes", nil); body != "param:hi *:yes" { |
| 1681 | t.Fatal(body) |
| 1682 | } |
| 1683 | } |
| 1684 | |
| 1685 | func TestMuxContextIsThreadSafe(t *testing.T) { |
| 1686 | router := NewRouter() |
nothing calls this directly
no test coverage detected