Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func WrapWithError ¶ added in v1.6.0
func WrapWithError(f HandlerFuncWithErr, log kitlog.Logger) http.HandlerFunc
Types ¶
type ErrorResponse ¶
An ErrorResponse reports errors caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type HandlerFuncWithErr ¶ added in v1.6.0
type HandlerFuncWithErr func(w http.ResponseWriter, r *http.Request) error
type MiddlewareFunc ¶ added in v1.6.0
func Authorize ¶ added in v1.6.0
func Authorize(headerName, wantHeader string) MiddlewareFunc
Authorize does a very simple header check against a wanted value it returns http.StatusUnauthorized if it's false
Click to show internal directories.
Click to hide internal directories.