Add 404 error for homekit API request

This commit is contained in:
Alex X
2025-11-18 20:40:30 +03:00
parent c72b205d87
commit 6c78b5cb53
+5 -1
View File
@@ -51,7 +51,11 @@ func apiHomekit(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
if id := r.Form.Get("id"); id != "" {
api.ResponsePrettyJSON(w, servers[id])
if srv := servers[id]; srv != nil {
api.ResponsePrettyJSON(w, srv)
} else {
http.Error(w, "server not found", http.StatusNotFound)
}
} else {
api.ResponsePrettyJSON(w, servers)
}