Documentation ¶
Overview ¶
Package handlers provides several non-proxy handlers for use internally by other Trickster handlers
Index ¶
- func ConfigHandleFunc(conf *config.Config) func(http.ResponseWriter, *http.Request)
- func HandleBadRequestResponse(w http.ResponseWriter, r *http.Request)
- func HandleLocalResponse(w http.ResponseWriter, r *http.Request)
- func HandleRedirectResponse(w http.ResponseWriter, r *http.Request)
- func PingHandleFunc(conf *config.Config) func(http.ResponseWriter, *http.Request)
- func ReloadHandleFunc(f reload.ReloaderFunc, conf *config.Config, wg *sync.WaitGroup, log *tl.Logger, ...) func(http.ResponseWriter, *http.Request)
- func WithRedirects(ctx context.Context, rc int, rl string) context.Context
- type SwitchHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigHandleFunc ¶
ConfigHandleFunc responds to the HTTP request with the running configuration
func HandleBadRequestResponse ¶
func HandleBadRequestResponse(w http.ResponseWriter, r *http.Request)
HandleBadRequestResponse responds to an HTTP Request with 400 Bad Request
func HandleLocalResponse ¶
func HandleLocalResponse(w http.ResponseWriter, r *http.Request)
HandleLocalResponse responds to an HTTP Request based on the local configuration without making any upstream requests
func HandleRedirectResponse ¶
func HandleRedirectResponse(w http.ResponseWriter, r *http.Request)
HandleRedirectResponse responds to an HTTP Request with a 302 Redirect with 30x code and Location header inserted into the context by a previous handler Requires redirectCode and redirectLocation have been set
func PingHandleFunc ¶
PingHandleFunc responds to an HTTP Request with 200 OK and "pong"
Types ¶
type SwitchHandler ¶
type SwitchHandler struct {
// contains filtered or unexported fields
}
SwitchHandler is an HTTP Wrapper that allows users to update the underlying handler in-place once associated with a net.Listener
func NewSwitchHandler ¶
func NewSwitchHandler(router http.Handler) *SwitchHandler
NewSwitchHandler returns a New *SwitchHandler
func (*SwitchHandler) Handler ¶
func (s *SwitchHandler) Handler() http.Handler
Handler returns the current mux
func (*SwitchHandler) ServeHTTP ¶
func (s *SwitchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves an HTTP Request
func (*SwitchHandler) Update ¶
func (s *SwitchHandler) Update(h http.Handler)
Update atomically changes the underlying handler without impacting user requests or uptime