Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultMiddleware ¶
func DefaultMiddleware(next http.HandlerFunc) http.HandlerFunc
DefaultMiddleware which handles Logging and Recover middleware
func LoggingMiddleware ¶
func LoggingMiddleware(next http.HandlerFunc) http.HandlerFunc
LoggingMiddleware for recovering from failed requests
func RecoveryMiddleware ¶
func RecoveryMiddleware(next http.HandlerFunc) http.HandlerFunc
RecoveryMiddleware for recovering from failed requests
Types ¶
type HealthCheckFunc ¶
type HealthCheckFunc func() HealthStatus
HealthCheckFunc defines a function for implementing a health check
type HealthStatus ¶
type HealthStatus int
HealthStatus type represanting the health of a service
const ( // Initializing represents a state before the service is Healthy Initializing HealthStatus = 0 // Healthy represents a state defining a healthy state Healthy HealthStatus = 1 // Unhealthy represents a state defining a unhealthy state Unhealthy HealthStatus = 2 )
type Option ¶
Option defines a option for the HTTP service
func SetHealthCheck ¶
func SetHealthCheck(hcf HealthCheckFunc) Option
SetHealthCheck option for setting the health check function
type ResponseWriter ¶
type ResponseWriter struct {
// contains filtered or unexported fields
}
ResponseWriter wrapper around the ResponseWriter to expose status
func NewResponseWriter ¶
func NewResponseWriter(w http.ResponseWriter) *ResponseWriter
NewResponseWriter constructor
func (*ResponseWriter) Header ¶
func (w *ResponseWriter) Header() http.Header
Header returns the header
func (*ResponseWriter) Status ¶
func (w *ResponseWriter) Status() int
Status returns the http response status
func (*ResponseWriter) Write ¶
func (w *ResponseWriter) Write(d []byte) (int, error)
Write to the internal ResponseWriter and sets the status if not set already
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(code int)
WriteHeader writes the internal header and saves the status for retrieval
type Route ¶
type Route struct {
Pattern string
Method string
Handler http.HandlerFunc
}
Route definition