handlers

package
v2.0.0-beta2.0...-3469a79 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package handlers provides several non-proxy handlers for use internally by other Trickster handlers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigHandleFunc

func ConfigHandleFunc(conf *config.Config) func(http.ResponseWriter, *http.Request)

ConfigHandleFunc responds to the HTTP request with the running configuration

func HandleBadGateway

func HandleBadGateway(w http.ResponseWriter, r *http.Request)

HandleBadGateway responds to an HTTP Request with 502 Bad Gateway

func HandleBadRequestResponse

func HandleBadRequestResponse(w http.ResponseWriter, r *http.Request)

HandleBadRequestResponse responds to an HTTP Request with 400 Bad Request

func HandleInternalServerError

func HandleInternalServerError(w http.ResponseWriter, r *http.Request)

HandleInternalServerError responds to an HTTP Request with 500 Internal Server Error

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

func PingHandleFunc(conf *config.Config) func(http.ResponseWriter, *http.Request)

PingHandleFunc responds to an HTTP Request with 200 OK and "pong"

func PurgeKeyHandleFunc

func PurgeKeyHandleFunc(conf *config.Config, from backends.Backends) func(http.ResponseWriter, *http.Request)

PurgeHandleFunc purges an object from a cache based on key.

func PurgePathHandlerFunc

func PurgePathHandlerFunc(conf *config.Config, from *backends.Backends) func(http.ResponseWriter, *http.Request)

func ReloadHandleFunc

func ReloadHandleFunc(f reload.ReloaderFunc, conf *config.Config, wg *sync.WaitGroup,
	logger logging.Logger, caches map[string]cache.Cache,
	args []string) func(http.ResponseWriter, *http.Request)

ReloadHandleFunc will reload the running configuration if it has changed

func WithRedirects

func WithRedirects(ctx context.Context, rc int, rl string) context.Context

WithRedirects will attach the configured redirect code and location information to the provided Context

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 router

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

Directories

Path Synopsis
Package health provides an application-wide health handler endpoint that is usually mapped to /trickster/health and provides the health status of the application's configured proxy endpoints
Package health provides an application-wide health handler endpoint that is usually mapped to /trickster/health and provides the health status of the application's configured proxy endpoints

Jump to

Keyboard shortcuts

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