summaryrefslogtreecommitdiff
path: root/plugins/gzip/plugin.go
blob: e5b9e4f56c0bfa2d9c6f4a441d5cba2f608bda12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package gzip

import (
	"net/http"

	"github.com/NYTimes/gziphandler"
)

const PluginName = "gzip"

type Gzip struct{}

func (g *Gzip) Init() error {
	return nil
}

func (g *Gzip) Middleware(next http.Handler) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		gziphandler.GzipHandler(next).ServeHTTP(w, r)
	}
}

func (g *Gzip) Name() string {
	return PluginName
}