pkg.go.dev

This section is empty.

Chain registers the pattern and http.Handler chain to the DefaultMuxChain.

func ChainHandlers

ChainHandlers chains together a set of handlers under an empty path.

func HandleChain

HandleChain is the utility function chained handlers are responsible for calling when they are complete.

type ChainedHandler

ChainedHander allows implementers to call the handlers after them in a muxchain on their own. This allows handlers to defer functions until after the handler chain following them has been completed.

type ChainedHandlerFunc

ChainedHandlerFunc represents a handler that is able to be chained to subsequent handlers.

func (ChainedHandlerFunc) ServeHTTP

ServeHTTP allows ChainedHandlerFuncs to implement http.Handler

func (ChainedHandlerFunc) ServeHTTPChain

ServeHTTPChain allows ChainedHandlerFuncs to be identified

CheckedResponseWriter augments http.ResponseWriter to indicate if the response has been written to.

type MuxChain struct {
	Muxer
}

Chain registers a pattern to a sequence of http.Handlers. Upon receiving a request, the mux chain will find the best matching pattern and call that chain of handlers. The handlers will be called in turn until one of them writes a response or the end of the chain is reached. If one of the handlers is a Muxer (e.g. http.ServeMux), the MuxChain will skip it if no pattern matches.

Muxer identifies types that act as a ServeMux.

Read the original on pkg.go.dev ↗