Documentation ¶
Index ¶
- func ErrorHandler(handler func(http.ResponseWriter, *http.Request) error) func(http.ResponseWriter, *http.Request)
- func ErrorRecovery(next http.Handler) http.Handler
- func GracefulShutdown(srv *http.Server, timeout time.Duration)
- func LoggingMiddleware(next http.Handler) http.Handler
- func RequestIdMiddleware(next http.Handler) http.Handler
- func RespondWithJSON(res http.ResponseWriter, code int, payload interface{})
- type HttpError
- func NewAuthorizationError(message string) *HttpError
- func NewBadRequestError(message string) *HttpError
- func NewFailedDependencyError(message string) *HttpError
- func NewForbiddenError(message string) *HttpError
- func NewNotFoundError(message string) *HttpError
- func NewTooManyRequestsError(message string) *HttpError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
func ErrorHandler(handler func(http.ResponseWriter, *http.Request) error) func(http.ResponseWriter, *http.Request)
func GracefulShutdown ¶
GracefulShutdown shuts down the given HTTP server gracefully when receiving an os.Interrupt or syscall.SIGTERM signal. It will wait for the specified timeout to stop hanging HTTP handlers.
func RespondWithJSON ¶
func RespondWithJSON(res http.ResponseWriter, code int, payload interface{})
Types ¶
type HttpError ¶
func NewAuthorizationError ¶
func NewBadRequestError ¶
func NewForbiddenError ¶
func NewNotFoundError ¶
func NewTooManyRequestsError ¶
func (*HttpError) WithDetail ¶
Click to show internal directories.
Click to hide internal directories.