httpjson

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxJSONBytes int64 = 1 << 20 // 1 MiB

DefaultMaxJSONBytes is the default cap for public JSON request bodies.

Variables

This section is empty.

Functions

func LimitBody added in v0.1.3

func LimitBody(w http.ResponseWriter, r *http.Request, n int64)

LimitBody wraps r.Body with http.MaxBytesReader so oversized payloads return 400 instead of unbounded buffering.

func Write

func Write(w http.ResponseWriter, status int, payload any)

Write encodes payload as JSON with the given status.

Types

This section is empty.

Jump to

Keyboard shortcuts

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