Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Common ¶
Common wraps the handler with common middleware to:
* Log requests * Recover from panics. * Add the request id to the context.
func Handler ¶ added in v0.10.1
Handler adapts an httpx.Handler to an http.Handler using the provided root context.
func LogRequests ¶ added in v0.10.1
LogRequests logs the requests to the embedded logger.
func PrefixRequestID ¶ added in v0.10.1
PrefixRequestID adds the request as a prefix to the log15.Logger.
Types ¶
type Recovery ¶ added in v0.10.1
type Recovery struct {
// contains filtered or unexported fields
}
Recovery is a middleware that will recover from panics and return the error.
func WithRecovery ¶ added in v0.10.1
func (*Recovery) ServeHTTPContext ¶ added in v0.10.1
func (h *Recovery) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) (err error)
ServeHTTPContext implements the httpx.Handler interface. It recovers from panics and returns an error for upstream middleware to handle.
Click to show internal directories.
Click to hide internal directories.