Documentation
¶
Index ¶
- Constants
- func DecodeJSON(r *http.Request, dst any) *wserr.Error
- func Do(ctx context.Context, c *http.Client, req *http.Request, retries int) (*http.Response, error)
- func JSON(w http.ResponseWriter, status int, v any)
- func NewClient(cfg ClientConfig) *http.Client
- func NewServer(cfg ServerConfig, h http.Handler) *http.Server
- func NoContent(w http.ResponseWriter)
- func RequireJSON(next http.Handler) http.Handler
- type CheckFunc
- type ClientConfig
- type Health
- type Page
- type ServerConfig
Constants ¶
View Source
const HeaderRequestID = "X-Request-ID"
Variables ¶
This section is empty.
Functions ¶
func JSON ¶
func JSON(w http.ResponseWriter, status int, v any)
JSON writes v as JSON with the given status code. It sets Content-Type to application/json; charset=utf-8. Encoding errors are ignored (best-effort) and must not panic.
func NewClient ¶
func NewClient(cfg ClientConfig) *http.Client
Types ¶
type ClientConfig ¶
type Health ¶
Health provides HTTP handlers for /healthz (liveness) and /readyz (readiness).
func NewHealth ¶
NewHealth creates a Health with the given timeout and dependency checks. If timeout <= 0, it defaults to 2 seconds.
Click to show internal directories.
Click to hide internal directories.