httputil

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package httputil holds tiny HTTP helpers shared across the REST and /healthz handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, status int, msg string)

Error writes a {"error": msg} JSON body with the given status.

func JSON

func JSON(w http.ResponseWriter, status int, body any)

JSON writes status and body as application/json, ignoring the encoder's write error (the response status has already been sent).

func NormalizeNamespace added in v0.6.0

func NormalizeNamespace(ns string) string

NormalizeNamespace trims surrounding whitespace and slashes and collapses duplicate separators into the canonical form stored namespaces use, so " work//memini/" addresses the same rows as "work/memini". It does not validate; pair with ValidateNamespace.

func ValidateNamespace

func ValidateNamespace(ns string) error

ValidateNamespace returns a non-nil error when ns is not a valid namespace. Valid namespaces are 1–256 bytes, contain no NUL character.

Types

This section is empty.

Jump to

Keyboard shortcuts

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