From 6f9e6245d7dd66dd5f73514deabb2fc680b446b9 Mon Sep 17 00:00:00 2001 From: Janne Mareike Koschinski <janne@kuschku.de> Date: Fri, 28 Feb 2025 13:03:40 +0100 Subject: [PATCH] fix: log requests and return status codes --- matrixbot.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/matrixbot.go b/matrixbot.go index 1758061..ede760a 100644 --- a/matrixbot.go +++ b/matrixbot.go @@ -72,9 +72,11 @@ func (bot *MatrixBot) HandleFunc(command string, handler func(bot *MatrixBot, no func (bot *MatrixBot) Serve(endpoint string) { http.HandleFunc("/healthz", func(writer http.ResponseWriter, request *http.Request) { + writer.WriteHeader(200) _, _ = io.WriteString(writer, "OK\n") }) http.HandleFunc("/_matrix/push/v1/notify", func(writer http.ResponseWriter, request *http.Request) { + log.Println("Received push notification") notification, err := api.ParseNotification(request.Body) if err != nil { log.Println(err.Error()) @@ -99,6 +101,7 @@ func (bot *MatrixBot) Serve(endpoint string) { log.Println(err.Error()) return } + writer.WriteHeader(204) }) log.Fatal(http.ListenAndServe(endpoint, nil)) } -- GitLab