Documentation
¶
Overview ¶
Package httpjson reads and writes size-limited JSON. callers handle authentication, media types, timeouts, closing bodies, and API errors. this package does not contain generated API or domain types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrTooLarge = errors.New("JSON body exceeds limit") ErrTrailingContent = errors.New("JSON contains trailing content") )
Functions ¶
func Decode ¶
Decode reads one JSON value and rejects unknown struct fields or trailing data. configure number handling and limit the input before calling it. the standard handling of null and duplicate object keys is unchanged.
func ReadAll ¶
ReadAll reads up to limit bytes and returns ErrTooLarge when more data exists. it does not close the reader. I/O failures are returned unchanged.
func Write ¶
func Write(response http.ResponseWriter, status int, value any)
Write sends an application/json response. if encoding fails after writing has started, it aborts the response instead of adding a second error body.
func WriteProblem ¶
func WriteProblem(response http.ResponseWriter, status int, value any)
WriteProblem sends an application/problem+json response.
Types ¶
This section is empty.