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: DefaultCompression, MinLength: 0, }
DefaultConfig is the default Gzip middleware config.
Functions ¶
func ContentTypeSkipper ¶ added in v16.10.0
func ContentTypeSkipper(contentTypes []string) middleware.Skipper
ContentTypesSkipper returns a Skipper based on the list of content types that should be compressed. If the list is empty, all responses will be compressed.
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 }
Config defines the config for Gzip middleware.
Click to show internal directories.
Click to hide internal directories.