summaryrefslogtreecommitdiff
path: root/plugins/gzip/plugin.go
blob: 133704f8c5a656604350e7920f12210d4a8f9b3b (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
26
27
28
29
30
31
32
33
34
package gzip

import (
	"net/http"

	"github.com/NYTimes/gziphandler"
	"github.com/gofiber/fiber/v2"
)

const PluginName = "gzip"

type Plugin struct{}

// Init needed for the Endure
func (g *Plugin) Init() error {
	return nil
}

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

func (g *Plugin) FiberMiddleware(ctx fiber.Ctx) {

}

// Available interface implementation
func (g *Plugin) Available() {}

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