add test for AsciiJSON in context

This commit is contained in:
Rex Lee(李俊) 2018-05-16 17:12:55 +08:00
parent 98acb016cf
commit 7c8d6339c8

View File

@ -686,6 +686,17 @@ func TestContextRenderNoContentSecureJSON(t *testing.T) {
assert.Equal(t, "application/json; charset=utf-8", w.HeaderMap.Get("Content-Type"))
}
func TestContextRenderNoContentAsciiJSON(t *testing.T) {
w := httptest.NewRecorder()
c, _ := CreateTestContext(w)
c.AsciiJSON(204, []string{"lang", "Go语言"})
assert.Equal(t, 204, w.Code)
assert.Empty(t, w.Body.String())
assert.Equal(t, "application/json", w.HeaderMap.Get("Content-Type"))
}
// Tests that the response executes the templates
// and responds with Content-Type set to text/html
func TestContextRenderHTML(t *testing.T) {