убрал конвертацию string в []byte в контроллере главной страницы, сделал запись в w http.ResponseWriter через fprintf

design
serr 2025-05-25 19:12:06 +03:00
parent cc3fe33474
commit 46ef8967b1
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package controllers_pages
import (
"fmt"
"log"
"main/mvc/models"
@ -70,7 +71,7 @@ func sendCount(w http.ResponseWriter, data []byte) {
func sendLove(w http.ResponseWriter) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(http.StatusOK)
w.Write([]byte("13.01.2005\n"))
fmt.Fprint(w, "13.01.2005\n")
}
// Ответ на метод LIMINAL
@ -78,6 +79,5 @@ func sendLiminal(w http.ResponseWriter) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(http.StatusOK)
text := "If you're not careful and you slip out of reality in the wrong place, you'll end up in the Backstage, where there's nothing but the stench of old damp carpet, yellow-colored madness, the endless unbearable hum of fluorescent lights, and roughly six hundred million square miles of randomly arranged empty rooms.\n"
w.Write([]byte(text))
fmt.Fprint(w, text)
}