bodylimit

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 11 Imported by: 0

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.

Jump to

Keyboard shortcuts

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