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

Function TestContextRenderIfErr

context_test.go:1049–1056  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1047func (*TestRender) WriteContentType(http.ResponseWriter) {}
1048
1049func TestContextRenderIfErr(t *testing.T) {
1050 w := httptest.NewRecorder()
1051 c, _ := CreateTestContext(w)
1052
1053 c.Render(http.StatusOK, &TestRender{})
1054
1055 assert.Equal(t, errorMsgs{&Error{Err: errTestRender, Type: 1}}, c.Errors)
1056}
1057
1058// Tests that the response is serialized as JSON
1059// and Content-Type is set to application/json

Callers

nothing calls this directly

Calls 2

CreateTestContextFunction · 0.85
RenderMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…