Documentation
¶
Overview ¶
Package wrappers provides tools to wrap http.handlerFuncs
Index ¶
Constants ¶
View Source
const (
// AuthorizorContextKey is the key used to store and retrieve an authorizor in the context
AuthorizorContextKey authorizorContextKey = 1
)
View Source
const (
// TIDContextKey is the key used to store a TID in a context. See https://blog.golang.org/context
TIDContextKey contextKey = 0
)
Variables ¶
View Source
var (
// TransIDHeader is the header name for transaction IDs.
TransIDHeader = "X-SITE-TRANS-ID"
)
Functions ¶
func AuthorizationWrapper ¶
func AuthorizationWrapper(next http.HandlerFunc) http.HandlerFunc
AuthorizationWrapper is a wrapper which will authorize requests on the provided endpoint
func TIDWrapper ¶
func TIDWrapper(next http.HandlerFunc) http.HandlerFunc
TIDWrapper creates a transaction ID for any request if not set. Generaly, this should be the first decorator applied
func Wrap ¶
func Wrap(handler http.HandlerFunc, wrappers ...Wrapper) http.HandlerFunc
Wrap an http.HandlerFunc with 0 or more Wrappers. The order of the wrappers is from outermost to innermost wrapper, or the order in which they will be called on a request.
Types ¶
type Wrapper ¶
type Wrapper func(http.HandlerFunc) http.HandlerFunc
Wrapper is an http handler function decorater
func NewAuthenticationWrapper ¶
func NewAuthenticationWrapper(authens []auth.Authenticator) Wrapper
NewAuthenticationWrapper creates a wrapper which will authenticate an endpoint using the supplied authenticators
func NewContentTypeWrapper ¶
NewContentTypeWrapper returns a wrapper which sets the content type for the request
Click to show internal directories.
Click to hide internal directories.