httplimit

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package httplimit provides generic HTTP request-body limiting middleware.

Index

Constants

View Source
const DefaultMaxRequestBodySize int64 = 8 << 20

DefaultMaxRequestBodySize is the fail-safe cap applied when no limit is configured.

Variables

This section is empty.

Functions

func IsRequestTooLarge

func IsRequestTooLarge(err error) bool

IsRequestTooLarge reports whether err is an http.MaxBytesReader overflow.

func Middleware

func Middleware(maxBytes int64) func(http.Handler) http.Handler

Middleware returns middleware that rejects bodies with a declared Content-Length larger than maxBytes before dispatch. Bodies with unknown or understated lengths are limited when downstream handlers read them. Non-positive limits fall back to DefaultMaxRequestBodySize.

Types

This section is empty.

Jump to

Keyboard shortcuts

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