Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (35 sloc) 692 Bytes

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

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,
}