Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(config Config) mw.Middleware
Middleware enforces a maximum request body size using a named configuration object.
Types ¶
type Config ¶
type Config struct {
// MaxBytes is the maximum request body size. Values less than or equal to
// zero disable the middleware.
MaxBytes int64
// Logger receives redacted overrun events when configured.
Logger log.StructuredLogger
}
Config controls request body limiting behavior.
func DefaultConfig ¶
func DefaultConfig(maxBytes int64, logger log.StructuredLogger) Config
DefaultConfig returns a body limit config with the configured maximum size.
Click to show internal directories.
Click to hide internal directories.