middleware

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheControl

func CacheControl(cacheHeaderValue string) mux.MiddlewareFunc

CacheControl takes a string and makes a header value to the key Cache-Control. This is so you can set some sane cache defaults to certain endpoints.

func ContentType added in v0.3.0

func ContentType(h http.Handler) http.Handler

ContentType writes an application/json Content-Type header.

func LogEntryMiddleware

func LogEntryMiddleware(lggr *log.Logger) mux.MiddlewareFunc

LogEntryMiddleware builds a log.Entry, setting the request fields and storing it in the context to be used throughout the stack.

func NewFilterMiddleware

func NewFilterMiddleware(mf *module.Filter, upstreamEndpoint string) mux.MiddlewareFunc

NewFilterMiddleware builds a middleware function that implements the filters configured in the filter file.

func NewValidationMiddleware

func NewValidationMiddleware(client *http.Client, validatorHook string) mux.MiddlewareFunc

NewValidationMiddleware builds a middleware function that performs validation checks by calling an external webhook.

func RequestLogger added in v0.3.0

func RequestLogger(h http.Handler) http.Handler

RequestLogger logs request params to standard output it should only be used during dev.

func WithRequestID added in v0.11.0

func WithRequestID(h http.Handler) http.Handler

WithRequestID ensures a request id is in the request context by either the incoming header or creating a new one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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