compress

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 10 Imported by: 0

README

http-compress

HTTP Compression middleware

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAllowedTypes = []*regexp.Regexp{
	regexp.MustCompile(`^text/`),
	regexp.MustCompile(`^application/json`),
	regexp.MustCompile(`^application/javascript`),
	regexp.MustCompile(`\+(xml|json)$`),
	regexp.MustCompile(`^image/svg`),
}

Functions

func Handler

func Handler(h http.Handler, options ...Option) http.Handler

Types

type EncoderFactory

type EncoderFactory func(ctx context.Context, w io.Writer) (io.WriteCloser, error)

type Option

type Option func(m *middleware)

func WihtoutEncoder

func WihtoutEncoder(encoding string) Option

func WithAllowedTypes

func WithAllowedTypes(list []*regexp.Regexp) Option

func WithEncoder

func WithEncoder(encoding string, priotity int, factory EncoderFactory) Option

func WithGzip

func WithGzip(priority, level int) Option

func WithMinSize

func WithMinSize(minSize uint64) Option

func WithSilent

func WithSilent() Option

Jump to

Keyboard shortcuts

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