Documentation ¶
Index ¶
- func AppInfo(app string, author string, version string) func(http.Handler) http.Handler
- func BlackWords(words ...string) func(http.Handler) http.Handler
- func Metrics(onlyIps ...string) func(http.Handler) http.Handler
- func OnlyFrom(onlyIps ...string) func(http.Handler) http.Handler
- func Ping(next http.Handler) http.Handler
- func Recoverer(next http.Handler) http.Handler
- func RenderJSON(w http.ResponseWriter, r *http.Request, data interface{})
- func RenderJSONFromBytes(w http.ResponseWriter, r *http.Request, data []byte) error
- func RenderJSONWithHTML(w http.ResponseWriter, r *http.Request, v interface{}) error
- func SendErrorJSON(w http.ResponseWriter, r *http.Request, code int, err error, msg string)
- type JSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlackWords ¶ added in v1.1.0
BlackWords middleware doesn't allow some words in the request body
func OnlyFrom ¶ added in v1.1.0
OnlyFrom middleware allows access for limited list of source IPs. Such IPs can be defined as complete ip (like 192.168.1.12), prefix (129.168.) or CIDR (192.168.0.0/16)
func Recoverer ¶
Recoverer is a middleware that recovers from panics, logs the panic and returns a HTTP 500 status if possible.
func RenderJSON ¶ added in v1.1.0
func RenderJSON(w http.ResponseWriter, r *http.Request, data interface{})
RenderJSON sends data as json
func RenderJSONFromBytes ¶
RenderJSONFromBytes sends binary data as json
func RenderJSONWithHTML ¶
func RenderJSONWithHTML(w http.ResponseWriter, r *http.Request, v interface{}) error
RenderJSONWithHTML allows html tags and forces charset=utf-8
func SendErrorJSON ¶
SendErrorJSON sends {error: msg} with error code and logging error and caller
Types ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.