traefik/middlewares/compress.go
Vincent Demeester 8a348423ae Import order as goimports does
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-30 19:04:02 +01:00

17 lines
382 B
Go

package middlewares
import (
"net/http"
"github.com/NYTimes/gziphandler"
)
// Compress is a middleware that allows redirections
type Compress struct {
}
// ServerHTTP is a function used by negroni
func (c *Compress) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
newGzipHandler := gziphandler.GzipHandler(next)
newGzipHandler.ServeHTTP(rw, r)
}