Commit 2817db40 authored by Aksel Baardsen's avatar Aksel Baardsen
Browse files

fixed ifelse logic fault

parent d2a408e4
......@@ -10,12 +10,13 @@ import (
func Dhandler(w http.ResponseWriter, r *http.Request) {
var diagnostics pkg.Diag
if err := pkg.GetDiag(&diagnostics); err != nil {
http.Error(w, "An error occurred", http.StatusBadGateway)
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(&diagnostics); err != nil {
log.Fatal(err)
err := pkg.GetDiag(&diagnostics)
if err != nil {
http.Error(w, err.Error(), http.StatusBadGateway)
} else {
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(&diagnostics); err != nil {
log.Fatal(err)
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment