Create test context properly

This commit is contained in:
Filip Figiel 2018-08-17 09:42:19 +02:00
parent 2000a13bd1
commit fa2e05accd

View File

@ -589,7 +589,8 @@ func TestContextRenderJSON(t *testing.T) {
// and Content-Type is set to application/json // and Content-Type is set to application/json
// and special HTML characters are preserved // and special HTML characters are preserved
func TestContextRenderPureJSON(t *testing.T) { func TestContextRenderPureJSON(t *testing.T) {
c, w, _ := CreateTestContext() w := httptest.NewRecorder()
c, _ := CreateTestContext(w)
c.PureJSON(201, H{"foo": "bar", "html": "<b>"}) c.PureJSON(201, H{"foo": "bar", "html": "<b>"})
assert.Equal(t, 201, w.Code) assert.Equal(t, 201, w.Code)
assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"<b>\"}\n", w.Body.String()) assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"<b>\"}\n", w.Body.String())