Documentation
¶
Overview ¶
Package jqmux offers an HTTP multiplexer which routes based on the incoming requests JSON body using the jq syntax of JSON value filtering
Limitations ¶
* Supports jq syntax to the level of https://github.com/savaki/jq
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultErrorHandler ¶
DefaultErrorHandler is the default error handler when calling NewMux
func DefaultNotFoundHandler ¶
func DefaultNotFoundHandler(w http.ResponseWriter, r *http.Request)
DefaultNotFoundHandler is the default http.Handler when calling NewMux
Types ¶
type JqMux ¶
type JqMux struct {
// contains filtered or unexported fields
}
JqMux is an HTTP request multiplexer. It matches the body of each incoming request against a list of registered jq patterns and calls the handler for the first pattern that matches given value.
func (*JqMux) Handle ¶
Handle registers the handler for the given pattern and match value. If the given jq pattern does not compile, Handle panics.
func (*JqMux) HandleFunc ¶
func (mux *JqMux) HandleFunc(pattern, match string, handler func(http.ResponseWriter, *http.Request))
HandleFunc is a convenience method which casts the given handler to http.HandlerFunc and registers the casted handler
type Option ¶
type Option func(*JqMux)
Option sets an option of the passed JqMux
func OptionErrorHandler ¶
OptionErrorHandler configures a custom error handler
func OptionNotFoundHandler ¶
OptionNotFoundHandler configures the http.Hander called on no matches