Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CORS ¶
type CORS struct { // Origin is a function that returns a value of // an Access-Control-Allow-Origin header. It cannot be nil. Origin func(r *http.Request) string // Headers is a function that returns a value of // an Access-Control-Allow-Headers header. It cannot be nil. Headers func(r *http.Request) string // Methods is a function that returns a value of // an Access-Control-Allow-Methods. It cannot be nil. Methods func(r *http.Request) string }
CORS adds a basic support for CORS preflight requests.
type HealthCheck ¶ added in v0.6.1
type HealthCheck struct { // Path is the path where the health check will be available. Path string // Check is a function that will be called to check the health of the service. Check func(r *http.Request) bool }
HealthCheck is a middleware that checks the health of the service, it may be used with Kubernetes' liveliness probe.
It returns a 200 response if the service is healthy, otherwise it returns a 503 response.
type Logger ¶
type Logger struct { // Log is an instance of a log.Logger. It cannot be nil, otherwise code will panic. Log log.Logger }
Logger prints logs for each request. If the log level is set to debug, it will print the contents of requests and responses.
Click to show internal directories.
Click to hide internal directories.