MCPcopy
hub / github.com/gin-gonic/gin / TestLiteralColonWithHandler

Function TestLiteralColonWithHandler

gin_test.go:1025–1041  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1023}
1024
1025func 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
1043func TestLiteralColonWithHTTPServer(t *testing.T) {
1044 SetMode(TestMode)

Callers

nothing calls this directly

Calls 7

SetModeFunction · 0.85
NewFunction · 0.85
GETMethod · 0.65
StringMethod · 0.65
JSONMethod · 0.45
HandlerMethod · 0.45
ServeHTTPMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…