Fixes context.String()

This commit is contained in:
Manu Mtz-Almeida 2014-07-05 02:51:52 +02:00
parent cde876395f
commit f387bdda9e

2
gin.go
View File

@ -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))
}