From 8419489349eb24841e36b32507acd5809fd7d4b9 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 8 Jul 2014 11:11:18 -0500 Subject: [PATCH 1/2] Proposed Dump function. --- gin.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gin.go b/gin.go index a06c13a5..00b1fb65 100644 --- a/gin.go +++ b/gin.go @@ -327,6 +327,14 @@ func (c *Context) Fail(code int, err error) { c.Abort(code) } +// Dump is the same as Fail except instead of an error +// you are able to dump out any data that you may need to +// trouble shoot for your application. +func (c *Context) Dump(code int, dump interface) { + c.Writer.Write([]byte(fmt.Sprint("%v", dump))) + c.Abort(code) +} + func (c *Context) ErrorTyped(err error, typ uint32, meta interface{}) { c.Errors = append(c.Errors, errorMsg{ Err: err.Error(), From 7aa677eb511cc5795d42914237309ebb737d31e8 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 8 Jul 2014 11:15:28 -0500 Subject: [PATCH 2/2] brackets --- gin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gin.go b/gin.go index 00b1fb65..facfa502 100644 --- a/gin.go +++ b/gin.go @@ -330,7 +330,7 @@ func (c *Context) Fail(code int, err error) { // Dump is the same as Fail except instead of an error // you are able to dump out any data that you may need to // trouble shoot for your application. -func (c *Context) Dump(code int, dump interface) { +func (c *Context) Dump(code int, dump interface{}) { c.Writer.Write([]byte(fmt.Sprint("%v", dump))) c.Abort(code) }