Tests that no JSON is rendered if code is 204
(t *testing.T)
| 1099 | |
| 1100 | // Tests that no JSON is rendered if code is 204 |
| 1101 | func TestContextRenderNoContentJSON(t *testing.T) { |
| 1102 | w := httptest.NewRecorder() |
| 1103 | c, _ := CreateTestContext(w) |
| 1104 | |
| 1105 | c.JSON(http.StatusNoContent, H{"foo": "bar"}) |
| 1106 | |
| 1107 | assert.Equal(t, http.StatusNoContent, w.Code) |
| 1108 | assert.Empty(t, w.Body.String()) |
| 1109 | assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type")) |
| 1110 | } |
| 1111 | |
| 1112 | // Tests that the response is serialized as JSON |
| 1113 | // we change the content-type before |
nothing calls this directly
no test coverage detected