(t *testing.T)
| 1541 | } |
| 1542 | |
| 1543 | func TestUseEncodedPath(t *testing.T) { |
| 1544 | r := NewRouter() |
| 1545 | r.UseEncodedPath() |
| 1546 | |
| 1547 | tests := []routeTest{ |
| 1548 | { |
| 1549 | title: "Router with useEncodedPath, URL with encoded slash does match", |
| 1550 | route: r.NewRoute().Path("/v1/{v1}/v2"), |
| 1551 | request: newRequest("GET", "http://localhost/v1/1%2F2/v2"), |
| 1552 | vars: map[string]string{"v1": "1%2F2"}, |
| 1553 | host: "", |
| 1554 | path: "/v1/1%2F2/v2", |
| 1555 | pathTemplate: `/v1/{v1}/v2`, |
| 1556 | shouldMatch: true, |
| 1557 | }, |
| 1558 | { |
| 1559 | title: "Router with useEncodedPath, URL with encoded slash doesn't match", |
| 1560 | route: r.NewRoute().Path("/v1/1/2/v2"), |
| 1561 | request: newRequest("GET", "http://localhost/v1/1%2F2/v2"), |
| 1562 | vars: map[string]string{"v1": "1%2F2"}, |
| 1563 | host: "", |
| 1564 | path: "/v1/1%2F2/v2", |
| 1565 | pathTemplate: `/v1/1/2/v2`, |
| 1566 | shouldMatch: false, |
| 1567 | }, |
| 1568 | } |
| 1569 | |
| 1570 | for _, test := range tests { |
| 1571 | t.Run(test.title, func(t *testing.T) { |
| 1572 | testRoute(t, test) |
| 1573 | testTemplate(t, test) |
| 1574 | }) |
| 1575 | } |
| 1576 | } |
| 1577 | |
| 1578 | func TestWalkSingleDepth(t *testing.T) { |
| 1579 | r0 := NewRouter() |
nothing calls this directly
no test coverage detected