middle

package
v0.0.0-...-2a8948e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2019 License: CC0-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyHandler

func BodyHandler(h http.Handler) http.Handler

func FrameHandler

func FrameHandler(h http.Handler) http.Handler

FrameHandler creates a new request context. The new context contains an empty frame.

func HandleError

func HandleError(w http.ResponseWriter, r *http.Request, err error)

func HandleResult

func HandleResult(w http.ResponseWriter, r *http.Request, msg string)

func RecoveryHandler

func RecoveryHandler(h http.Handler) http.Handler

RecoveryHandler adds panic recovery and logs the stack trace

func RequestIDHandler

func RequestIDHandler(h http.Handler) http.Handler

RequestIDHandler assigns a UUID to the request

func RequestPathHandler

func RequestPathHandler(h http.Handler) http.Handler

RequestPathHandler adds the request path to the logging context

func ResponseHandler

func ResponseHandler(handle respHandle) httprouter.Handle

func WriteMessage

func WriteMessage(w http.ResponseWriter, r *http.Request, statusCode int, body string)

Types

type Response

type Response struct {
	UUID    string `json:"uuid"`
	Error   string `json:"error,omitempty"`
	Message string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL