From f387bdda9e165aee139233a1a8a5cb79ea9ea84d Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Sat, 5 Jul 2014 02:51:52 +0200 Subject: [PATCH] Fixes context.String() --- gin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gin.go b/gin.go index 30b1afb..fc49c83 100644 --- a/gin.go +++ b/gin.go @@ -472,10 +472,10 @@ func (c *Context) HTML(code int, name string, data interface{}) { // Writes the given string into the response body and sets the Content-Type to "text/plain". func (c *Context) String(code int, msg string) { + c.Writer.Header().Set("Content-Type", MIMEPlain) if code >= 0 { c.Writer.WriteHeader(code) } - c.Writer.Header().Set("Content-Type", MIMEPlain) c.Writer.Write([]byte(msg)) }