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

Function TestRenderPureJSON

render/render_test.go:272–282  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

270}
271
272func TestRenderPureJSON(t *testing.T) {
273 w := httptest.NewRecorder()
274 data := map[string]any{
275 "foo": "bar",
276 "html": "<b>",
277 }
278 err := (PureJSON{data}).Render(w)
279 require.NoError(t, err)
280 assert.JSONEq(t, "{\"foo\":\"bar\",\"html\":\"<b>\"}\n", w.Body.String())
281 assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type"))
282}
283
284type xmlmap map[string]any
285

Callers

nothing calls this directly

Calls 4

RenderMethod · 0.65
StringMethod · 0.65
GetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected