httplimit

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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