Files
test_deploy/internal/http/build_info.go
Alex Shevchuk d84487d238 1
2025-08-18 17:12:04 +03:00

28 lines
588 B
Go

package http_router
import (
"encoding/json"
"net/http"
)
func (h *handler) getBuildInfoHandler(w http.ResponseWriter, _ *http.Request) {
response := struct {
Version string `json:"version"`
Commit string `json:"commit"`
Date string `json:"date"`
}{
Version: h.buildConfig.Version,
Commit: h.buildConfig.Commit,
Date: h.buildConfig.Date,
}
responseJSON, err := json.Marshal(response)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write(responseJSON)
}