diff options
author | Valery Piashchynski <[email protected]> | 2020-11-27 16:08:27 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-27 16:08:27 +0300 |
commit | 6abfe73b5f7b66a7be094486e29ab3f2ab1ce940 (patch) | |
tree | 888b5eb96ab396ef53f77ce3944ed62af9cc878d /plugins/gzip/plugin.go | |
parent | b5020bfce6b5362400cb9b578fe32c1a6ed5d61a (diff) |
Gzip plugin
Diffstat (limited to 'plugins/gzip/plugin.go')
-rw-r--r-- | plugins/gzip/plugin.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/gzip/plugin.go b/plugins/gzip/plugin.go new file mode 100644 index 00000000..f5a0f4ea --- /dev/null +++ b/plugins/gzip/plugin.go @@ -0,0 +1,26 @@ +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 +} |