missing encoder for tree

This commit is contained in:
Umputun
2018-01-07 19:47:34 -06:00
parent c15ff27437
commit 539a3c46bc
+8 -2
View File
@@ -240,8 +240,14 @@ func (s *Server) findCommentsCtrl(w http.ResponseWriter, r *http.Request) {
if r.URL.Query().Get("format") == "tree" {
treeComments := format.MakeTree(comments, r.URL.Query().Get("sort"))
s.respCache.Set(cacheKey, treeComments, time.Hour)
renderJSONWithHTML(w, r, treeComments)
b, err := encodeJSONWithHTML(treeComments)
if err != nil {
common.SendErrorJSON(w, r, http.StatusInternalServerError, err, "can't encode comments")
return
}
s.respCache.Set(cacheKey, b, time.Hour)
renderJSONFromBytes(w, r, b)
return
}