1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-24 03:16:14 +02:00

Pretty print in debug mode

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2017-01-04 12:00:49 -08:00
parent c935874aa8
commit 54fb1015c1

View File

@ -385,6 +385,9 @@ func (c *context) String(code int, s string) (err error) {
}
func (c *context) JSON(code int, i interface{}) (err error) {
if c.echo.Debug {
return c.JSONPretty(code, i, " ")
}
b, err := json.Marshal(i)
if err != nil {
return
@ -426,6 +429,9 @@ func (c *context) JSONPBlob(code int, callback string, b []byte) (err error) {
}
func (c *context) XML(code int, i interface{}) (err error) {
if c.echo.Debug {
return c.XMLPretty(code, i, " ")
}
b, err := xml.Marshal(i)
if err != nil {
return