mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 01:57:55 +08:00
Fix tests style
This commit is contained in:
parent
5c704908d8
commit
f01951917b
@ -575,9 +575,9 @@ func TestContextRenderJSON(t *testing.T) {
|
||||
w := httptest.NewRecorder()
|
||||
c, _ := CreateTestContext(w)
|
||||
|
||||
c.JSON(http.StatusCreated, H{"foo": "bar", "html": "<b>"})
|
||||
c.JSON(201, H{"foo": "bar", "html": "<b>"})
|
||||
|
||||
assert.Equal(t, http.StatusCreated, w.Code)
|
||||
assert.Equal(t, 201, w.Code)
|
||||
assert.Equal(
|
||||
t,
|
||||
"{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n",
|
||||
@ -591,7 +591,7 @@ func TestContextRenderJSON(t *testing.T) {
|
||||
func TestContextRenderPureJSON(t *testing.T) {
|
||||
c, w, _ := CreateTestContext()
|
||||
c.PureJSON(201, H{"foo": "bar", "html": "<b>"})
|
||||
assert.Equal(t, w.Code, 201)
|
||||
assert.Equal(t, 201, w.Code)
|
||||
assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"<b>\"}\n", w.Body.String())
|
||||
assert.Equal(t, "application/json; charset=utf-8", w.HeaderMap.Get("Content-Type"))
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ func TestRenderJSON(t *testing.T) {
|
||||
assert.Equal(t, "{\"foo\":\"bar\"}", w.Body.String())
|
||||
assert.Equal(
|
||||
t,
|
||||
w.Body.String(),
|
||||
"{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n")
|
||||
assert.Equal(t, w.Header().Get("Content-Type"), "application/json; charset=utf-8")
|
||||
"{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n",
|
||||
w.Body.String())
|
||||
assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type"))
|
||||
}
|
||||
|
||||
func TestRenderPureJSON(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user