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

Function TestContextRenderNoContentXML

context_test.go:1312–1321  ·  view source on GitHub ↗

Tests that no XML is rendered if code is 204

(t *testing.T)

Source from the content-addressed store, hash-verified

1310
1311// Tests that no XML is rendered if code is 204
1312func TestContextRenderNoContentXML(t *testing.T) {
1313 w := httptest.NewRecorder()
1314 c, _ := CreateTestContext(w)
1315
1316 c.XML(http.StatusNoContent, H{"foo": "bar"})
1317
1318 assert.Equal(t, http.StatusNoContent, w.Code)
1319 assert.Empty(t, w.Body.String())
1320 assert.Equal(t, "application/xml; charset=utf-8", w.Header().Get("Content-Type"))
1321}
1322
1323// TestContextRenderString tests that the response is returned
1324// with Content-Type set to text/plain

Callers

nothing calls this directly

Calls 5

CreateTestContextFunction · 0.85
XMLMethod · 0.80
StringMethod · 0.65
GetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…