middleware

package
v0.0.0-...-cd3ace8 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStatusRequestEntityTooLarge = errors.New("request entity too large")
)

Functions

func Bind

func Bind(handler http.Handler, m ...Middleware) http.Handler

Bind is bind middleware to handler.

Types

type BodyLimitConfig

type BodyLimitConfig struct {
	Limit   byteutil.Size    // limit byte size of request body
	OnError http.HandlerFunc // custom error handler
}

BodyLimitConfig is configuration of BodyLimit middleware.

type Middleware

type Middleware func(next http.Handler) http.Handler

Middleware is http server middleware function.

func BodyLimit

func BodyLimit(limit byteutil.Size) Middleware

BodyLimit is limiting body size.

func BodyLimitWithConfig

func BodyLimitWithConfig(config BodyLimitConfig) Middleware

BodyLimitWithConfig is limiting body size.

func ContentEncoding

func ContentEncoding(encodings ...encoding.Encoding) Middleware

ContentEncoding decodes the request data according to the Content-Encoding header, and encodes the response data according to the Accept-Encoding header.

func ContentType

func ContentType(types ...string) Middleware

ContentType is checks the value of the Content-Type header and returns an error if it does not match. If the HTTP method is either GET, HEAD, CONNECT, OPTIONS, TRACE, the checking process will be skipped.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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