Documentation
¶
Overview ¶
Package httpx contains tiny cross-handler helpers for JSON error envelopes and status mapping. Keeping it in its own package prevents import cycles between core and mode packages.
Index ¶
Constants ¶
const APIPrefixHeader = "X-SpeechKit-API-Prefix"
APIPrefixHeader carries the external API mount prefix after an internal route alias rewrites /api/v1/* to the stable /v1/* handler tree.
Variables ¶
This section is empty.
Functions ¶
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, code, message string)
WriteError emits a standard JSON error envelope and sets the status code. It never panics; encoding failures degrade to an empty body.
func WriteErrorWithDetails ¶
func WriteErrorWithDetails(w http.ResponseWriter, status int, code, message string, details map[string]any)
WriteErrorWithDetails is the same as WriteError but attaches a details map.
func WriteModeDisabled ¶ added in v0.40.1
func WriteModeDisabled(w http.ResponseWriter, mode string)
WriteModeDisabled emits the canonical disabled-mode envelope used by the Server-Target when an endpoint exists but its owning mode is configured off.
Types ¶
type ErrorBody ¶
type ErrorBody struct {
Error ErrorDetail `json:"error"`
}
ErrorBody is the wire shape of every 4xx/5xx response from the SpeechKit server adapter. It is deliberately minimal so consumers (kombify-AI, OSS integrators) can pin to a stable contract.