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

Function TestGET

ginS/gins_test.go:21–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19}
20
21func TestGET(t *testing.T) {
22 GET("/test", func(c *gin.Context) {
23 c.String(http.StatusOK, "test")
24 })
25
26 req := httptest.NewRequest(http.MethodGet, "/test", nil)
27 w := httptest.NewRecorder()
28 engine().ServeHTTP(w, req)
29
30 assert.Equal(t, http.StatusOK, w.Code)
31 assert.Equal(t, "test", w.Body.String())
32}
33
34func TestPOST(t *testing.T) {
35 POST("/post", func(c *gin.Context) {

Callers

nothing calls this directly

Calls 3

GETFunction · 0.85
StringMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected