From d984c6fd1f36a29ae921c3dbde92269594b842d1 Mon Sep 17 00:00:00 2001 From: serr Date: Sun, 6 Apr 2025 16:14:17 +0300 Subject: [PATCH] love method added --- mvc/controllers/pages/main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mvc/controllers/pages/main.go b/mvc/controllers/pages/main.go index 99c7d55..d792cd4 100644 --- a/mvc/controllers/pages/main.go +++ b/mvc/controllers/pages/main.go @@ -24,6 +24,12 @@ func MainPageHandler(a *models.App) http.HandlerFunc { return } + // Пасхалка + if r.Method == "LOVE" { + SendLove(w) + return + } + // Страничка рендерится только если ее нет в кэше pageData, ok := a.Cache.Get(models_pages.MainPageTmplName) if !ok { @@ -52,3 +58,10 @@ func SendCount(w http.ResponseWriter, data []byte) { w.WriteHeader(http.StatusOK) w.Write(data) } + +// Ответ на метод LOVE +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")) +}