fix prev comment

This commit is contained in:
Umputun
2018-05-19 11:35:47 -05:00
parent 1cdb25fa6a
commit 292853b51d
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -336,7 +336,7 @@ func (s *Rest) lastCommentsCtrl(w http.ResponseWriter, r *http.Request) {
filterDeleted = append(filterDeleted, c)
}
return encodeJSONWithHTML(comments)
return encodeJSONWithHTML(filterDeleted)
})
if err != nil {
@@ -425,6 +425,9 @@ func (s *Rest) configCtrl(w http.ResponseWriter, r *http.Request) {
authNames = append(authNames, ap.Name)
}
cnf.Auth = authNames
if s.Authenticator.Admins == nil { // prevent json serialization to nil
s.Authenticator.Admins = []string{}
}
render.Status(r, http.StatusOK)
render.JSON(w, r, cnf)
}
+2 -2
View File
@@ -487,8 +487,8 @@ func prep(t *testing.T) (srv *Rest, ts *httptest.Server) {
}
func withBasicAuth(r *http.Request, username, password string) *http.Request {
auth := username + ":" + password
r.Header.Add("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(auth)))
creds := username + ":" + password
r.Header.Add("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(creds)))
return r
}