Faster IndentedJSON + unit tests

This commit is contained in:
Manu Mtz-Almeida
2015-05-11 01:04:08 +02:00
parent a9dad532ae
commit 3df5dfdb7f
2 changed files with 18 additions and 1 deletions

View File

@ -329,7 +329,9 @@ func (c *Context) HTML(code int, name string, obj interface{}) {
}
func (c *Context) IndentedJSON(code int, obj interface{}) {
c.Render(code, render.IndentedJSON, obj)
if err := render.WriteIndentedJSON(c.Writer, code, obj); err != nil {
c.renderingError(err, obj)
}
}
// Serializes the given struct as JSON into the response body in a fast and efficient way.