diff --git a/context_17_test.go b/context_17_test.go index c4bc6588..d2251904 100644 --- a/context_17_test.go +++ b/context_17_test.go @@ -7,6 +7,7 @@ package gin import ( + "net/http" "net/http/httptest" "testing" @@ -19,8 +20,8 @@ import ( func TestContextRenderPureJSON(t *testing.T) { w := httptest.NewRecorder() c, _ := CreateTestContext(w) - c.PureJSON(201, H{"foo": "bar", "html": ""}) - assert.Equal(t, 201, w.Code) + c.PureJSON(http.StatusCreated, H{"foo": "bar", "html": ""}) + assert.Equal(t, http.StatusCreated, w.Code) assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"\"}\n", w.Body.String()) assert.Equal(t, "application/json; charset=utf-8", w.HeaderMap.Get("Content-Type")) } diff --git a/context_test.go b/context_test.go index 1c7217ea..100e6b85 100644 --- a/context_test.go +++ b/context_test.go @@ -575,13 +575,10 @@ func TestContextRenderJSON(t *testing.T) { w := httptest.NewRecorder() c, _ := CreateTestContext(w) - c.JSON(201, H{"foo": "bar", "html": ""}) + c.JSON(http.StatusCreated, H{"foo": "bar", "html": ""}) - assert.Equal(t, 201, w.Code) - assert.Equal( - t, - "{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}", - w.Body.String()) + assert.Equal(t, http.StatusCreated, w.Code) + assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}", w.Body.String()) assert.Equal(t, "application/json; charset=utf-8", w.HeaderMap.Get("Content-Type")) } diff --git a/render/render_test.go b/render/render_test.go index 3407c8ee..5189403d 100644 --- a/render/render_test.go +++ b/render/render_test.go @@ -50,10 +50,7 @@ func TestRenderJSON(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "{\"foo\":\"bar\"}", w.Body.String()) - assert.Equal( - t, - "{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n", - w.Body.String()) + assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n", w.Body.String()) assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type")) }