Add 404 error for homekit API request
This commit is contained in:
@@ -51,7 +51,11 @@ func apiHomekit(w http.ResponseWriter, r *http.Request) {
|
|||||||
switch r.Method {
|
switch r.Method {
|
||||||
case "GET":
|
case "GET":
|
||||||
if id := r.Form.Get("id"); id != "" {
|
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 {
|
} else {
|
||||||
api.ResponsePrettyJSON(w, servers)
|
api.ResponsePrettyJSON(w, servers)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user