From 6da7374af5c776343ab8ef61c9146f8e0aa2e0fd Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Fri, 4 Jul 2014 00:37:54 +0200 Subject: [PATCH] Do not update status code in Abort() if code is a negative number --- gin.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gin.go b/gin.go index 3b584d94..4b619183 100644 --- a/gin.go +++ b/gin.go @@ -301,7 +301,9 @@ func (c *Context) Next() { // For example, the first handler checks if the request is authorized. If it's not, context.Abort(401) should be called. // The rest of pending handlers would never be called for that request. func (c *Context) Abort(code int) { - c.Writer.WriteHeader(code) + if code >= 0 { + c.Writer.WriteHeader(code) + } c.index = AbortIndex }