handlers

package
v0.1.31-0...-b1e5c7a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2018 License: ISC Imports: 7 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL