Пример #1
0
func (p PanicRecovery) ServeHTTPChain(w http.ResponseWriter, req *http.Request, h ...http.Handler) {
	recovery := p.Recovery
	if recovery == nil {
		recovery = http.HandlerFunc(DefaultRecoverFunc)
	}
	defer func() {
		if r := recover(); r != nil {
			recovery.ServeHTTP(w, req)
		}
	}()
	muxchain.HandleChain(w, req, h...)
}
Пример #2
0
func gzipHandler(w http.ResponseWriter, req *http.Request, h ...http.Handler) {
	w.Header().Add("Content-Encoding", "gzip")
	g, gw := newGzipResponse(w)
	defer g.Close()
	muxchain.HandleChain(gw, req, h...)
}