diff pkg/middleware/json.go @ 4244:4394daeea96a json-handler-middleware

Moved JSONHandler into middleware package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 22 Aug 2019 11:26:48 +0200
parents 6f9d00c8cc38
children 6270951dda28
line wrap: on
line diff
--- a/pkg/middleware/json.go	Thu Aug 22 10:54:08 2019 +0200
+++ b/pkg/middleware/json.go	Thu Aug 22 11:26:48 2019 +0200
@@ -34,13 +34,13 @@
 	return req.Context().Value(jsonInputKey)
 }
 
-// JSONInput is a middleware to deserialize the incomming
+// JSONMiddleware is a middleware to deserialize the incomming
 // request body to a object to be created by a given input function
 // and stores the result into the context.
 // GetJSONInput can be used to receive the deserialized data.
 // limit limits the size of the incoming body to prevent
 // flooding the server.
-func JSONInput(next http.Handler, input func(*http.Request) interface{}, limit int64) http.Handler {
+func JSONMiddleware(next http.Handler, input func(*http.Request) interface{}, limit int64) http.Handler {
 
 	return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
 		dst := input(req)