8a348423ae
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
17 lines
382 B
Go
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)
|
|
}
|