mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 01:57:55 +08:00
Create test context properly
This commit is contained in:
parent
2000a13bd1
commit
fa2e05accd
@ -589,7 +589,8 @@ func TestContextRenderJSON(t *testing.T) {
|
||||
// and Content-Type is set to application/json
|
||||
// and special HTML characters are preserved
|
||||
func TestContextRenderPureJSON(t *testing.T) {
|
||||
c, w, _ := CreateTestContext()
|
||||
w := httptest.NewRecorder()
|
||||
c, _ := CreateTestContext(w)
|
||||
c.PureJSON(201, H{"foo": "bar", "html": "<b>"})
|
||||
assert.Equal(t, 201, w.Code)
|
||||
assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"<b>\"}\n", w.Body.String())
|
||||
|
Loading…
x
Reference in New Issue
Block a user