diff --git a/dhcp.go b/dhcp.go index 738f8dad..d025b6b5 100644 --- a/dhcp.go +++ b/dhcp.go @@ -110,12 +110,11 @@ func handleDHCPInterfaces(w http.ResponseWriter, r *http.Request) { // implement func handleDHCPFindActiveServer(w http.ResponseWriter, r *http.Request) { found, err := dhcpd.CheckIfOtherDHCPServersPresent(config.DHCP.InterfaceName) - result := map[string]interface{}{ - "found": found, - } + result := map[string]interface{}{} if err != nil { - result["found"] = false - result["error"] = err + result["error"] = err.Error() + } else { + result["found"] = found } w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(result)