Implement helper response handling functions

This commit is contained in:
2025-10-26 00:12:33 +02:00
parent a3f9213f04
commit 94dce4c9bb
6 changed files with 83 additions and 119 deletions

View File

@@ -16,7 +16,7 @@ import (
// @Router /version [get]
func (h *Handler) VersionHandler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
fmt.Fprintf(w, "Version: %s\nCommit: %s\nBuild Time: %s\n", h.cfg.Version, h.cfg.CommitHash, h.cfg.BuildTime)
versionInfo := fmt.Sprintf("Version: %s\nCommit: %s\nBuild Time: %s\n", h.cfg.Version, h.cfg.CommitHash, h.cfg.BuildTime)
writeText(w, http.StatusOK, versionInfo)
}
}