1
0
Fork 0

Add HTTP compression

This commit is contained in:
tuier 2016-09-28 22:07:06 +01:00
parent 067f13b61c
commit 17546c3a08
5 changed files with 58 additions and 29 deletions

16
middlewares/compress.go Normal file
View file

@ -0,0 +1,16 @@
package middlewares
import (
"github.com/NYTimes/gziphandler"
"net/http"
)
// Rewrite is a middleware that allows redirections
type Compress struct {
}
//
func (_ *Compress) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
newGzipHandler := gziphandler.GzipHandler(next)
newGzipHandler.ServeHTTP(rw, r)
}