Documentation
¶
Overview ¶
Package httputil provides common HTTP utilities shared across servers.
Index ¶
Constants ¶
View Source
const MaxRequestBodySize = 1 << 20
MaxRequestBodySize is the maximum allowed request body size (1MB). This prevents memory exhaustion attacks via large payloads.
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶
DecodeJSON decodes JSON from the request body into the target. It uses LimitedBody to prevent oversized payloads.
func LimitedBody ¶
func LimitedBody(w http.ResponseWriter, r *http.Request, maxBytes int64) io.ReadCloser
LimitedBody wraps a request body with a size limit. Returns a ReadCloser that will return an error if the body exceeds maxBytes.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.