gzip

package
v0.0.0-...-31c1c1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL