Documentation
¶
Index ¶
- func Decode(r *http.Request, target interface{}) error
- func LoggerMiddleware(logger zerolog.Logger) func(next http.Handler) http.Handler
- func RecovererMiddleware(logger zerolog.Logger) func(next http.Handler) http.Handler
- func RenderJSON(w http.ResponseWriter, v interface{}) error
- func RenderString(w http.ResponseWriter, s string) error
- func RenderStringf(w http.ResponseWriter, format string, args ...interface{}) error
- func WrapHandler(f HandlerFunc) http.HandlerFunc
- func WriteStatus(w http.ResponseWriter, status int, contentType string)
- type ErrorHandler
- type HandlerFunc
- type ResponseWriter
- type StatusError
- type TemplateSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoggerMiddleware ¶
func RecovererMiddleware ¶
func RenderJSON ¶
func RenderJSON(w http.ResponseWriter, v interface{}) error
func RenderString ¶
func RenderString(w http.ResponseWriter, s string) error
func RenderStringf ¶
func RenderStringf(w http.ResponseWriter, format string, args ...interface{}) error
func WrapHandler ¶
func WrapHandler(f HandlerFunc) http.HandlerFunc
func WriteStatus ¶
func WriteStatus(w http.ResponseWriter, status int, contentType string)
Types ¶
type ErrorHandler ¶
type ErrorHandler func(ResponseWriter, *http.Request, error)
var DefaultErrorHandler ErrorHandler = defaultErrorHandler
type HandlerFunc ¶
type HandlerFunc func(ResponseWriter, *http.Request) error
type ResponseWriter ¶
type ResponseWriter interface { http.ResponseWriter // Status returns the HTTP status of the request, or 0 if one has not // yet been sent. Status() int // BytesWritten returns the total number of bytes sent to the client. BytesWritten() int // Unwrap returns the original proxied target. Unwrap() http.ResponseWriter }
ResponseWriter is a proxy around an http.ResponseWriter that allows you to hook into various parts of the response process.
func NewResponseWriter ¶
func NewResponseWriter(w http.ResponseWriter, protoMajor int) ResponseWriter
NewResponseWriter wraps an http.ResponseWriter, returning a proxy that allows you to hook into various parts of the response process.
type StatusError ¶
func NewError ¶
func NewError(statusCode int, err error) StatusError
type TemplateSet ¶
type TemplateSet struct {
// contains filtered or unexported fields
}
func NewTemplateSet ¶
Click to show internal directories.
Click to hide internal directories.