Beispiel #1
0
func unauthorizedHandler(env *config.Env, w http.ResponseWriter, r *http.Request) {
	helpers.HandleError(env, w, r, http.StatusForbidden, errors.New("Invalid Session."))
}
Beispiel #2
0
// ServeHTTP allows our Handler type to satisfy http.Handler.
func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	status, err := h.h(h.e, w, r) // apply middleware here...
	helpers.HandleError(h.e, w, r, status, err)
	context.Clear(r) // remove context when the request is finished
}