handlers

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const HealthcheckPath = "/healthcheck"

Variables

View Source
var GitSHA string

GitSHA populated at build-time with: -ldflags "-X github.com/cbsinteractive/bakery/handlers.GitSHA=$(git rev-parse HEAD)"

Functions

func LoadHandler

func LoadHandler(c config.Config) http.Handler

LoadHandler loads the handler for all the requests

Types

type ErrorResponse added in v0.1.5

type ErrorResponse struct {
	Message string              `json:"message"`
	Errors  map[string][]string `json:"errors"`
	Err     error               `json:"-"`
}

ErrorResponse holds the errore response message

func NewErrorResponse added in v0.1.5

func NewErrorResponse(message string, err error) ErrorResponse

NewErrorResponse holds a formatted error response Errors returned from the parser, origin, filter packages Will return in a `key: err` format. Where the key signals the package scope source of the error

func (*ErrorResponse) HandleError added in v0.1.5

func (e *ErrorResponse) HandleError(ctx context.Context, w http.ResponseWriter, code int)

HandleError will both log and handle the http error for a given error response

type Healthcheck added in v0.1.18

type Healthcheck struct {
	GitSHA string `json:"git_sha"`
}

Healthcheck is returned when querying for service health

type HealthcheckHandler added in v0.1.18

type HealthcheckHandler struct{}

HealthcheckHandler responds to health check requests

func (HealthcheckHandler) ServeHTTP added in v0.1.18

ServeHTTP will return a http.StatusOK code if the service is up

Jump to

Keyboard shortcuts

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