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

Function TestResponseWriterFlush

response_writer_test.go:255–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

253}
254
255func TestResponseWriterFlush(t *testing.T) {
256 testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
257 writer := &responseWriter{}
258 writer.reset(w)
259
260 writer.WriteHeader(http.StatusInternalServerError)
261 writer.Flush()
262 }))
263 defer testServer.Close()
264
265 // should return 500
266 resp, err := http.Get(testServer.URL)
267 require.NoError(t, err)
268 assert.Equal(t, http.StatusInternalServerError, resp.StatusCode)
269}
270
271func TestResponseWriterStatusCode(t *testing.T) {
272 testWriter := httptest.NewRecorder()

Callers

nothing calls this directly

Calls 5

resetMethod · 0.95
WriteHeaderMethod · 0.95
FlushMethod · 0.95
CloseMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected