Adds pretty print to info
This commit is contained in:
+3
-7
@@ -102,13 +102,9 @@ func streamsHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
v = streams.All()
|
v = streams.All()
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(v)
|
e := json.NewEncoder(w)
|
||||||
if err != nil {
|
e.SetIndent("", " ")
|
||||||
log.Error().Err(err).Msg("[api.streams] marshal")
|
_ = e.Encode(v)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_, _ = w.Write(data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func apiWS(w http.ResponseWriter, r *http.Request) {
|
func apiWS(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
+1
-9
@@ -54,15 +54,7 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
items = append(items, device)
|
items = append(items, device)
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(items)
|
_= json.NewEncoder(w).Encode(items)
|
||||||
if err != nil {
|
|
||||||
log.Error().Err(err).Msg("[api.homekit]")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err = w.Write(data); err != nil {
|
|
||||||
log.Error().Err(err).Msg("[api.homekit]")
|
|
||||||
}
|
|
||||||
|
|
||||||
case "POST":
|
case "POST":
|
||||||
// TODO: post params...
|
// TODO: post params...
|
||||||
|
|||||||
Reference in New Issue
Block a user