Mercurial > gemma
diff controllers/json.go @ 341:889517f254f5
Use code of JSONError as HTTP code.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 06 Aug 2018 12:36:20 +0200 |
parents | 0777aa6de45b |
children |
line wrap: on
line diff
--- a/controllers/json.go Sun Aug 05 15:48:36 2018 +0200 +++ b/controllers/json.go Mon Aug 06 12:36:20 2018 +0200 @@ -74,7 +74,10 @@ } case JSONError: rw.Header().Set("Content-Type", "application/json") - rw.WriteHeader(http.StatusInternalServerError) + if e.Code == 0 { + e.Code = http.StatusInternalServerError + } + rw.WriteHeader(e.Code) var res = struct { Message string `json:"message"` }{