Tests that no Custom JSON is rendered if code is 204
(t *testing.T)
| 1125 | |
| 1126 | // Tests that no Custom JSON is rendered if code is 204 |
| 1127 | func TestContextRenderNoContentAPIJSON(t *testing.T) { |
| 1128 | w := httptest.NewRecorder() |
| 1129 | c, _ := CreateTestContext(w) |
| 1130 | |
| 1131 | c.Header("Content-Type", "application/vnd.api+json") |
| 1132 | c.JSON(http.StatusNoContent, H{"foo": "bar"}) |
| 1133 | |
| 1134 | assert.Equal(t, http.StatusNoContent, w.Code) |
| 1135 | assert.Empty(t, w.Body.String()) |
| 1136 | assert.Equal(t, "application/vnd.api+json", w.Header().Get("Content-Type")) |
| 1137 | } |
| 1138 | |
| 1139 | // Tests that the response is serialized as JSON |
| 1140 | // and Content-Type is set to application/json |
nothing calls this directly
no test coverage detected