9
0
mirror of https://github.com/Lomanic/fuz-spaceapi synced 2024-11-10 18:47:31 +00:00

Add error message in HTTP response when spaceapi fails to request backend API

This commit is contained in:
Lomanic 2020-12-15 21:15:09 +02:00
parent 2369064908
commit 3bf0baba8a

View File

@ -90,6 +90,7 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
resp, err := http.Get(config.PRESENCEAPI) resp, err := http.Get(config.PRESENCEAPI)
if err != nil { if err != nil {
w.WriteHeader(http.StatusServiceUnavailable) w.WriteHeader(http.StatusServiceUnavailable)
fmt.Fprintf(w, "err: unable to request presence API: %v", err)
return return
} }
defer resp.Body.Close() defer resp.Body.Close()