Versions in this module Expand all Collapse all v0 v0.0.2 Oct 1, 2023 v0.0.1 Sep 30, 2023 Changes in this version + const ErrorCodeTMP000 + const HdrValApplicationJSON + const HdrValStrictTransportSecurity + const HdrValTextPlain + const SchemeHTTP + const SchemeHTTPS + func Error(r *http.Request, w http.ResponseWriter, code int, format string, args ...any) + func OK(w http.ResponseWriter) + func UserAgent() (ua string) + func WriteJSONResponse(w http.ResponseWriter, r *http.Request, code int, resp any) + func WriteJSONResponseError(w http.ResponseWriter, r *http.Request, err error) + func WriteJSONResponseOK(w http.ResponseWriter, r *http.Request, v any) + func WriteTextPlainDeprecated(w http.ResponseWriter, r *http.Request) (isPlainText bool) + type ErrorCode string + type HTTPAPIErrorResp struct + Code ErrorCode + Msg string + type JSONDuration time.Duration + func (d *JSONDuration) UnmarshalJSON(b []byte) (err error) + func (d JSONDuration) MarshalJSON() (b []byte, err error) + type JSONTime time.Time + func (t *JSONTime) UnmarshalJSON(b []byte) (err error) + func (t JSONTime) MarshalJSON() (b []byte, err error) + type RegisterFunc func(method, url string, handler http.HandlerFunc)