Documentation
¶
Overview ¶
Package httpapi serves the public HTTP API, following its contract (api/openapi.yaml): the server and its timeouts, the probes, and the middleware every request goes through (request identifier, access log, panic recovery, security headers). It never serves HTML: every error is an RFC 9457 problem.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler returns the handler of the API: its routes behind the request middleware.
Types ¶
type Options ¶
type Options struct {
// Ready backs /readyz.
Ready Readiness
// Logger receives the access log and the recovered panics.
Logger *slog.Logger
// NewID makes a request identifier when the client sent no valid one;
// nil means crypto/rand.Text.
NewID func() string
// ProblemBase is the URL of the documentation of the problems, ending
// with a slash: the type of a problem is its code under it.
ProblemBase string
}
Options configures the handler.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package contracttest checks HTTP exchanges against the public contract, api/openapi.yaml.
|
Package contracttest checks HTTP exchanges against the public contract, api/openapi.yaml. |
Click to show internal directories.
Click to hide internal directories.