Browse Source

fasthttp: added missing ';charset=utf-8' suffix to Content-Type for plaintext and fortune responses

Aliaksandr Valialkin 9 years ago
parent
commit
ae94c296a5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      frameworks/Go/fasthttp/src/hello/hello.go

+ 2 - 2
frameworks/Go/fasthttp/src/hello/hello.go

@@ -156,7 +156,7 @@ func fortuneHandler(ctx *fasthttp.RequestCtx) {
 
 
 	sort.Sort(FortunesByMessage(fortunes))
 	sort.Sort(FortunesByMessage(fortunes))
 
 
-	ctx.SetContentType("text/html")
+	ctx.SetContentType("text/html; charset=utf-8")
 	if err := tmpl.Execute(ctx, fortunes); err != nil {
 	if err := tmpl.Execute(ctx, fortunes); err != nil {
 		log.Fatalf("Error executing fortune: %s", err)
 		log.Fatalf("Error executing fortune: %s", err)
 	}
 	}
@@ -195,7 +195,7 @@ func updateHandler(ctx *fasthttp.RequestCtx) {
 
 
 // Test 6: Plaintext
 // Test 6: Plaintext
 func plaintextHandler(ctx *fasthttp.RequestCtx) {
 func plaintextHandler(ctx *fasthttp.RequestCtx) {
-	ctx.Success("text/plain", helloWorldBytes)
+	ctx.Write(helloWorldBytes)
 }
 }
 
 
 func jsonMarshal(ctx *fasthttp.RequestCtx, v interface{}) {
 func jsonMarshal(ctx *fasthttp.RequestCtx, v interface{}) {