Mercurial > gemma
diff controllers/json.go @ 257:dfc2b035e055
Slimming down the signature of the JSONHandler type to
not take the http.ResponseWriter.
Idea of this handler is to simply transform JSON to JSON.
The input is already parsed. The output is generated from
JSONResult. So there is no need to pass the ResponseWriter
to the handler function.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 27 Jul 2018 13:03:56 +0200 |
parents | 3b688fe04c39 |
children | 0777aa6de45b |
line wrap: on
line diff
--- a/controllers/json.go Fri Jul 27 12:30:19 2018 +0200 +++ b/controllers/json.go Fri Jul 27 13:03:56 2018 +0200 @@ -19,7 +19,7 @@ type JSONHandler struct { Input func() interface{} - Handle func(http.ResponseWriter, *http.Request, interface{}, *sql.DB) (JSONResult, error) + Handle func(interface{}, *http.Request, *sql.DB) (JSONResult, error) } type JSONError struct { @@ -46,7 +46,7 @@ token, _ := auth.GetToken(req) var jr JSONResult err := auth.ConnPool.Do(token, func(db *sql.DB) (err error) { - jr, err = j.Handle(rw, req, input, db) + jr, err = j.Handle(input, req, db) return err })