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

Function TestLiteralColonWithDirectServeHTTP

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

Source from the content-addressed store, hash-verified

1007}
1008
1009func TestLiteralColonWithDirectServeHTTP(t *testing.T) {
1010 SetMode(TestMode)
1011 router := New()
1012
1013 router.GET(`/test\:action`, func(c *Context) {
1014 c.JSON(http.StatusOK, H{"path": "literal_colon"})
1015 })
1016
1017 w := httptest.NewRecorder()
1018 req, _ := http.NewRequest(http.MethodGet, "/test:action", nil)
1019 router.ServeHTTP(w, req)
1020
1021 assert.Equal(t, http.StatusOK, w.Code)
1022 assert.Contains(t, w.Body.String(), "literal_colon")
1023}
1024
1025func TestLiteralColonWithHandler(t *testing.T) {
1026 SetMode(TestMode)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected