Documentation
¶
Overview ¶
Package httputil provides HTTP utilities for LocalGo
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RespondError ¶
func RespondError(w http.ResponseWriter, statusCode int, message string)
RespondError sends an error response
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, statusCode int, data interface{})
RespondJSON sends a JSON response. The data is marshalled before any headers are written so that a marshal failure can still produce a proper 500 response.
func RespondOK ¶
func RespondOK(w http.ResponseWriter)
RespondOK sends an OK response with no content
func SetLogger ¶ added in v0.3.6
func SetLogger(l *zap.SugaredLogger)
SetLogger configures the package-level logger used by httputil helpers. Call this once at server startup with the same logger used by handlers.
Types ¶
Click to show internal directories.
Click to hide internal directories.