# HG changeset patch # User Sascha L. Teichmann # Date 1532617783 -7200 # Node ID 2b39bf2bf1fd109a964851e85b4804f5db5d82a8 # Parent 3771788d3daed8c8070deae9072f7c00afa69779 If no error code was given in a JSONResult assume Status OK (200). diff -r 3771788d3dae -r 2b39bf2bf1fd controllers/json.go --- a/controllers/json.go Thu Jul 26 17:07:03 2018 +0200 +++ b/controllers/json.go Thu Jul 26 17:09:43 2018 +0200 @@ -86,6 +86,10 @@ return } + if jr.Code == 0 { + jr.Code = http.StatusOK + } + rw.Header().Set("Content-Type", "application/json") rw.WriteHeader(jr.Code) if err := json.NewEncoder(rw).Encode(jr.Result); err != nil {