(t *testing.T)
| 582 | } |
| 583 | |
| 584 | func TestEscapedColon(t *testing.T) { |
| 585 | router := New() |
| 586 | f := func(u string) { |
| 587 | router.GET(u, func(c *Context) { c.String(http.StatusOK, u) }) |
| 588 | } |
| 589 | f("/r/r\\:r") |
| 590 | f("/r/r:r") |
| 591 | f("/r/r/:r") |
| 592 | f("/r/r/\\:r") |
| 593 | f("/r/r/r\\:r") |
| 594 | assert.Panics(t, func() { |
| 595 | f("\\foo:") |
| 596 | }) |
| 597 | |
| 598 | router.updateRouteTrees() |
| 599 | ts := httptest.NewServer(router) |
| 600 | defer ts.Close() |
| 601 | |
| 602 | testRequest(t, ts.URL+"/r/r123", "", "/r/r:r") |
| 603 | testRequest(t, ts.URL+"/r/r:r", "", "/r/r\\:r") |
| 604 | testRequest(t, ts.URL+"/r/r/r123", "", "/r/r/:r") |
| 605 | testRequest(t, ts.URL+"/r/r/:r", "", "/r/r/\\:r") |
| 606 | testRequest(t, ts.URL+"/r/r/r:r", "", "/r/r/r\\:r") |
| 607 | } |
nothing calls this directly
no test coverage detected