Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteInternalError ¶
func WriteInternalError(w http.ResponseWriter, err error, logMsg string, attrs ...any)
WriteInternalError logs the error with logMsg and attrs, then writes 500 and {"error": "internal error"}. logMsg is the slog message (e.g. "auth handler error", "portal handler error").
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, status int, data any)
WriteJSON sets Content-Type application/json, writes status code, and encodes data as JSON.
func WriteJSONError ¶
func WriteJSONError(w http.ResponseWriter, status int, message string)
WriteJSONError sets Content-Type application/json, writes status code, and a body {"error": "<message>"}.
func WriteQuotaExceeded ¶
func WriteQuotaExceeded(w http.ResponseWriter, reason string)
WriteQuotaExceeded writes HTTP 429 with JSON body {"error": reason}.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.