Help us shape the future of Go! Take the 2026 Go Developer Survey

httpjson

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r *http.Request, dest any) error

Decode decodes a JSON request body into dest and closes the body.

func Error

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

Error writes a standard JSON error response.

func ErrorMessage

func ErrorMessage(body []byte) string

ErrorMessage returns the error field from a JSON error body when present.

func Write

func Write(w http.ResponseWriter, status int, v any) error

Write writes a JSON response with the given status code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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