Documentation ¶
Index ¶
- Variables
- func DefaultErrorHandler(err error, _ *http.Request, w http.ResponseWriter)
- func Handler(h http.Handler, options ...Option) http.Handler
- type EncoderFactory
- type ErrorHandler
- type Middleware
- type Option
- func WihtoutEncoder(encoding string) Option
- func WithAllowedTypes(list []*regexp.Regexp) Option
- func WithEncoder(encoding string, priotity int, factory EncoderFactory) Option
- func WithErrorHandler(handler ErrorHandler) Option
- func WithGzip(priority, level int) Option
- func WithMinSize(minSize uint64) Option
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 DefaultErrorHandler ¶ added in v0.2.0
func DefaultErrorHandler(err error, _ *http.Request, w http.ResponseWriter)
Types ¶
type EncoderFactory ¶
type ErrorHandler ¶ added in v0.2.0
type ErrorHandler func(error, *http.Request, http.ResponseWriter)
type Middleware ¶ added in v0.1.0
func New ¶ added in v0.1.0
func New(options ...Option) Middleware
type Option ¶
type Option func(*config)
func WihtoutEncoder ¶
func WithAllowedTypes ¶
func WithEncoder ¶
func WithEncoder(encoding string, priotity int, factory EncoderFactory) Option
func WithErrorHandler ¶ added in v0.2.0
func WithErrorHandler(handler ErrorHandler) Option
func WithMinSize ¶
Click to show internal directories.
Click to hide internal directories.