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

Function TestPUT

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

Source from the content-addressed store, hash-verified

45}
46
47func TestPUT(t *testing.T) {
48 PUT("/put", func(c *gin.Context) {
49 c.String(http.StatusOK, "updated")
50 })
51
52 req := httptest.NewRequest(http.MethodPut, "/put", nil)
53 w := httptest.NewRecorder()
54 engine().ServeHTTP(w, req)
55
56 assert.Equal(t, http.StatusOK, w.Code)
57 assert.Equal(t, "updated", w.Body.String())
58}
59
60func TestDELETE(t *testing.T) {
61 DELETE("/delete", func(c *gin.Context) {

Callers

nothing calls this directly

Calls 3

PUTFunction · 0.85
StringMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected