| 1023 | } |
| 1024 | |
| 1025 | func TestLiteralColonWithHandler(t *testing.T) { |
| 1026 | SetMode(TestMode) |
| 1027 | router := New() |
| 1028 | |
| 1029 | router.GET(`/test\:action`, func(c *Context) { |
| 1030 | c.JSON(http.StatusOK, H{"path": "literal_colon"}) |
| 1031 | }) |
| 1032 | |
| 1033 | handler := router.Handler() |
| 1034 | |
| 1035 | w := httptest.NewRecorder() |
| 1036 | req, _ := http.NewRequest(http.MethodGet, "/test:action", nil) |
| 1037 | handler.ServeHTTP(w, req) |
| 1038 | |
| 1039 | assert.Equal(t, http.StatusOK, w.Code) |
| 1040 | assert.Contains(t, w.Body.String(), "literal_colon") |
| 1041 | } |
| 1042 | |
| 1043 | func TestLiteralColonWithHTTPServer(t *testing.T) { |
| 1044 | SetMode(TestMode) |