1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-01 22:09:21 +02:00
echo/website/content/middleware/gzip.md
Vishal Rana 054a310e70 updated website
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-11-20 14:51:17 -08:00

705 B

+++ title = "Gzip Middleware" description = "Gzip middleware for Echo" [menu.main] name = "Gzip" parent = "middleware" weight = 5 +++

Gzip middleware compresses HTTP response using gzip compression scheme.

Usage

e.Use(middleware.Gzip())

Custom Configuration

Usage

e := echo.New()
e.Use(middleware.GzipWithConfig(middleware.GzipConfig{
  Level: 5,
}))

Configuration

GzipConfig struct {
  // Skipper defines a function to skip middleware.
  Skipper Skipper

  // Gzip compression level.
  // Optional. Default value -1.
  Level int `json:"level"`
}

Default Configuration

DefaultGzipConfig = GzipConfig{
  Skipper: defaultSkipper,
  Level:   -1,
}