Mercurial > gemma
diff pkg/middleware/json.go @ 5712:6270951dda28 revive-cleanup
/interface{}/any/
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 20 Feb 2024 22:37:51 +0100 |
parents | 4394daeea96a |
children |
line wrap: on
line diff
--- a/pkg/middleware/json.go Tue Feb 20 22:22:57 2024 +0100 +++ b/pkg/middleware/json.go Tue Feb 20 22:37:51 2024 +0100 @@ -30,7 +30,7 @@ // GetJSONInput returns the deserialized JSON data from // the incoming request if any. -func GetJSONInput(req *http.Request) interface{} { +func GetJSONInput(req *http.Request) any { return req.Context().Value(jsonInputKey) } @@ -40,7 +40,7 @@ // GetJSONInput can be used to receive the deserialized data. // limit limits the size of the incoming body to prevent // flooding the server. -func JSONMiddleware(next http.Handler, input func(*http.Request) interface{}, limit int64) http.Handler { +func JSONMiddleware(next http.Handler, input func(*http.Request) any, limit int64) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { dst := input(req)