mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-26 15:05:50 +03:00
/dhcp/find_active_dhcp API — Don't return 'found' key when there's an error. And return error string.
This commit is contained in:
parent
6fd9af3c60
commit
f5e7eed447
1 changed files with 4 additions and 5 deletions
9
dhcp.go
9
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)
|
||||
|
|
Loading…
Reference in a new issue