From 415415b5b29945ed578140e6b9aa43792d5b1574 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sat, 5 Dec 2015 15:56:10 +0100 Subject: [PATCH] Response with Bad Request to bad config posts, not Internal Server Errors The error is the clients fault, or so we think, so we should not accept the blame. --- cmd/syncthing/gui.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index c714e2c3c..6575ceac6 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -578,7 +578,7 @@ func (s *apiSvc) postSystemConfig(w http.ResponseWriter, r *http.Request) { to, err := config.ReadJSON(r.Body, myID) if err != nil { l.Warnln("decoding posted config:", err) - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusBadRequest) return } @@ -587,7 +587,7 @@ func (s *apiSvc) postSystemConfig(w http.ResponseWriter, r *http.Request) { hash, err := bcrypt.GenerateFromPassword([]byte(to.GUI.Password), 0) if err != nil { l.Warnln("bcrypting password:", err) - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusInternalServerError) return }