middleware

package
v0.0.0-...-2a67a25 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Endpoints

func Endpoints(e func(EndpointsBuilder)) func(http.Handler) http.Handler

func GetRequestID

func GetRequestID(ctx context.Context) string

GetRequestID returns the ID set by the RequestID middleware

func Logging

func Logging(next http.Handler) http.Handler

Logging logs the current request

func NewFiles

func NewFiles(prefix string, filePath string) func(http.Handler) http.Handler

NewFiles creates a new instance of the file middleware

func NextRequestID

func NextRequestID() uint64

NextRequestID generates the next request ID

func ProxyHeaders

func ProxyHeaders(next http.Handler) http.Handler

ProxyHeaders parses proxy headers such as X-Forward-For and X-Forward-Proto

func RequestID

func RequestID(next http.Handler) http.Handler

RequestID adds an ID to the request used for tracing

func RouteParam

func RouteParam(r *http.Request, key string) string

func Spa

func Spa(filePath string) func(http.Handler) http.Handler

Spa creates a new instance of the file middleware

func Time

func Time(next http.Handler) http.Handler

Time times how long it takes to execute the request and appends a header

Types

type EndpointsBuilder

type EndpointsBuilder interface {
	Get(url string, handler http.HandlerFunc)
	Post(url string, handler http.HandlerFunc)
	Put(url string, handler http.HandlerFunc)
	Delete(url string, handler http.HandlerFunc)
	Method(method string, url string, handler http.HandlerFunc)
}

Jump to

Keyboard shortcuts

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