httpx

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package httpx holds the response helpers every v2 handler shares.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteError

func WriteError(w http.ResponseWriter, status int, code, message string, details map[string]any)

WriteError sends the error envelope. A nil details map encodes as null, as the reference does.

func WriteJSON

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

WriteJSON sends v with status. An encode failure after the status line means the client went away, so there is nothing left to report to it.

Types

type Detail

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

Detail is the body of an error envelope.

type Envelope

type Envelope struct {
	Error Detail `json:"error"`
}

Envelope is the v2 error shape: {"error": {code, message, details}}. SDKs match on code, so codes are the reference's exact strings.

Jump to

Keyboard shortcuts

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