Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestId ¶
RequestId returns the id of the current request set in context, or an empty string.
func WithRequestId ¶
func WithRequestId(handlerFunc http.HandlerFunc) http.HandlerFunc
WithRequestId is an middleware that assigns request id for each incoming request. The assigned id can be retrieved downstream by
requestId := RequestId(ctx)
func WriteErrorToBody ¶
func WriteErrorToBody(rw http.ResponseWriter, err error)
WriteErrorToBody writes the given error in JSON format to HTTP response body.
Types ¶
Click to show internal directories.
Click to hide internal directories.