go-echo-middleware-Gzip 中间件

Gzip 中间件使用 gzip 方案来对 HTTP 响应进行压缩。

用法

e.Use(middleware.Gzip())

自定义配置

用法

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

配置

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

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

默认配置

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

Leave a Reply

Your email address will not be published. Required fields are marked *