1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-29 22:48:07 +02:00

Middleware interface

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-02-07 23:02:37 -08:00
parent f27de9a804
commit 65fcca2ce3
8 changed files with 74 additions and 54 deletions

View File

@@ -48,10 +48,10 @@ var writerPool = sync.Pool{
// Gzip returns a middleware which compresses HTTP response using gzip compression
// scheme.
func Gzip() echo.MiddlewareFunc {
scheme := "gzip"
func Gzip() MiddlewareFunc {
return func(h echo.HandlerFunc) echo.HandlerFunc {
scheme := "gzip"
return func(c echo.Context) error {
c.Response().Header().Add(echo.Vary, echo.AcceptEncoding)
if strings.Contains(c.Request().Header().Get(echo.AcceptEncoding), scheme) {