httpx

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteProblem

func WriteProblem(w http.ResponseWriter, status int, p Problem)

WriteProblem writes a problem+json response with the provided status code. It merges extension fields after the standard members, per RFC 7807.

func WriteSimpleProblem

func WriteSimpleProblem(w http.ResponseWriter, status int, title, detail string)

WriteSimpleProblem is a convenience for common cases.

Types

type Problem

type Problem struct {
	Type     string         `json:"type,omitempty"`
	Title    string         `json:"title,omitempty"`
	Status   int            `json:"status,omitempty"`
	Detail   string         `json:"detail,omitempty"`
	Instance string         `json:"instance,omitempty"`
	Ext      map[string]any `json:"-"`
}

Problem represents an RFC 7807 problem+json response body. See: https://datatracker.ietf.org/doc/html/rfc7807

func (*Problem) With

func (p *Problem) With(key string, value any) *Problem

With adds an extension field to the problem payload.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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