Documentation
¶
Index ¶
- func MarshalCookie(val any) (string, error)
- func ReadJSON(r *http.Request, ptr any) error
- func Serve(ctx context.Context, addr string, r http.Handler, graceT time.Duration) error
- func UnmarshalCookie(r *http.Request, key string, into any) bool
- func WrapErrH(fn func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc
- func WriteErr(w http.ResponseWriter, r *http.Request, err error)
- func WriteJSON(w http.ResponseWriter, r *http.Request, status int, v any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalCookie ¶
MarshalCookie marshals 'val' using JSON, encodes using Base64 and returns.
func Serve ¶
Serve serves the given handler on 'addr'. Blocks until server exits due to critical error. On context-cancellation, server will be shutdown gracefully.
func UnmarshalCookie ¶
UnmarshalCookie reads the cookie value as base64 encoded JSON value. Returns true if successful.
func WrapErrH ¶
func WrapErrH(fn func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc
WrapErrH is an extended version of http.HandlerFunc with automatic error handling.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.