Documentation
¶
Index ¶
Constants ¶
View Source
const ( BestCompression = gzip.BestCompression BestSpeed = gzip.BestSpeed DefaultCompression = gzip.DefaultCompression NoCompression = gzip.NoCompression )
Variables ¶
View Source
var DefaultConfig = Config{ Skipper: middleware.DefaultSkipper, Level: -1, MinLength: 0, ContentTypes: []string{"text/plain", "text/html"}, }
DefaultConfig is the default Gzip middleware config.
Functions ¶
func New ¶
func New() echo.MiddlewareFunc
New returns a middleware which compresses HTTP response using gzip compression scheme.
func NewWithConfig ¶
func NewWithConfig(config Config) echo.MiddlewareFunc
NewWithConfig return Gzip middleware with config. See: `New()`.
Types ¶
type Config ¶
type Config struct {
// Skipper defines a function to skip middleware.
Skipper middleware.Skipper
// Gzip compression level.
// Optional. Default value -1.
Level int
// Length threshold before gzip compression
// is used. Optional. Default value 0
MinLength int
// Content-Types to compress. Empty for all
// files. Optional. Default value "text/plain" and "text/html"
ContentTypes []string
}
Config defines the config for Gzip middleware.
Click to show internal directories.
Click to hide internal directories.