httpx

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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

This section is empty.

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.

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.

type ErrorDetail

type ErrorDetail struct {
	Code    string         `json:"code"`
	Message string         `json:"message"`
	Details map[string]any `json:"details,omitempty"`
}

ErrorDetail carries the machine-readable code and the human-friendly message. Additional context belongs in Details (a free-form map).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL