diff --git a/config.go b/config.go index 4602a1a..6198e3c 100644 --- a/config.go +++ b/config.go @@ -16,6 +16,6 @@ func ReadConfig(file string) (Config, error) { return Config{}, err } var result Config - json.Unmarshal(bytes, &result) - return result, nil + err = json.Unmarshal(bytes, &result) + return result, err } diff --git a/server/api.go b/server/api.go index 270a186..f777cf2 100644 --- a/server/api.go +++ b/server/api.go @@ -11,7 +11,10 @@ func writeJSON(w http.ResponseWriter, a interface{}) { http.Error(w, "500 Internal Server Error", http.StatusInternalServerError) } w.Header().Set("Content-Type", "application/json") - w.Write(bytes) + _, err = w.Write(bytes) + if err != nil { + http.Error(w, "500 Internal Server Error", http.StatusInternalServerError) + } } func allStatus(w http.ResponseWriter, req *http.Request) {