Documentation
¶
Overview ¶
Package web holds the HTTP plumbing shared by the JSON APIs in this repo: the error wire shape, build identity, and the version handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VersionHandler ¶
func VersionHandler(service string) http.HandlerFunc
VersionHandler serves {service, ...Build} so a caller can confirm which build is running.
Types ¶
type BadRequestError ¶
BadRequestError marks a body the transport could not read (400), as distinct from a well-formed request that failed validation (422).
func (*BadRequestError) Error ¶
func (e *BadRequestError) Error() string
func (*BadRequestError) Unwrap ¶
func (e *BadRequestError) Unwrap() error
type Build ¶
type Build struct {
Revision string `json:"revision"`
Modified bool `json:"modified"`
Time string `json:"time"`
Go string `json:"go"`
}
Build is the VCS identity Go stamps into a binary. Revision is empty under -buildvcs=false, which reads as an unknown build.
type ErrorBody ¶
type ErrorBody struct {
Kind string `` /* 182-byte string literal not displayed */
Message string `json:"message"`
Fields map[string]string `` /* 131-byte string literal not displayed */
}
ErrorBody is the error wire shape: {kind, message}, with per-field detail on validation failures.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package extractors decodes and validates request input: Body decodes into a typed struct and runs its Validate method when it has one.
|
Package extractors decodes and validates request input: Body decodes into a typed struct and runs its Validate method when it has one. |
|
Package mid holds the errchain error middleware shared by the JSON APIs.
|
Package mid holds the errchain error middleware shared by the JSON APIs. |
Click to show internal directories.
Click to hide internal directories.