Documentation
¶
Overview ¶
Package handlers provides a set of functions to manipulate http.HandlerFunc at a route level. cf github.com/taironas/gonawin/gonawin/main.go for details on how to use it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
func ErrorHandler(f func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc
ErrorHandler returns the proper error handler function with respecto to the error rised by the function called.
Types ¶
type ErrorHandlerFunc ¶
type ErrorHandlerFunc func(http.ResponseWriter, *http.Request) error
ErrorHandlerFunc is a handler returning an error.
func AdminAuthorized ¶
func AdminAuthorized(f func(w http.ResponseWriter, r *http.Request, u *mdl.User) error) ErrorHandlerFunc
AdminAuthorized runs the function pass by parameter and checks authentication data prior to any call. Will rise a bad request error handler if authentication fails. User should be a gonawin admin .
func Authorized ¶
func Authorized(f func(w http.ResponseWriter, r *http.Request, u *mdl.User) error) ErrorHandlerFunc
Authorized runs the function pass by parameter and checks authentication data prior to any call. Will rise a bad request error handler if authentication fails.