Use json marshall in context json to fix breaking new line issue. Fixes #2209 (#2228)

* ignore IntelliJ idea generated files

* update JSON renderer to use Marshall() instead of Encode(). Fix #2209

* Revert "ignore IntelliJ idea generated files"

This reverts commit e7bd017227df5dbd2ed2f5fe353adb5f1b08c678.

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
This commit is contained in:
Kaushik Neelichetty
2020-02-21 14:45:17 +05:30
committed by GitHub
parent 863ad2d4de
commit 5f56109bcf
5 changed files with 15 additions and 12 deletions

View File

@ -36,7 +36,7 @@ func TestRenderJSON(t *testing.T) {
err := (JSON{data}).Render(w)
assert.NoError(t, err)
assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n", w.Body.String())
assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}", w.Body.String())
assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type"))
}