Documentation
¶
Overview ¶
Package httpjson decodes strict JSON request bodies and writes JSON responses. Its functions are safe for concurrent use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode requires Content-Type application/json, reads at most 64 KiB, rejects unknown fields and trailing data. Errors are plain and never repeat request text; callers wrap them as *auth.Error{Kind: auth.ErrInvalidRequest}.
func Write ¶
func Write(writer http.ResponseWriter, status int, body any)
Write writes body as JSON with status, Content-Type application/json and Cache-Control no-store. A body that does not encode (an identity carrying an invalid auth.Permission from application code) is answered 500 internal instead, before anything was written.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.