Procházet zdrojové kódy

Fixes context.String()

Manu Mtz-Almeida před 11 roky
rodič
revize
f387bdda9e
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      gin.go

+ 1 - 1
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))
 }