Documentation
¶
Index ¶
- func Error(err error, code int) error
- func SetCacheHeaders(w http.ResponseWriter, maxAge time.Duration, timeUntilExpiry time.Duration)
- func SetNoCacheHeaders(w http.ResponseWriter)
- func WriteErrorJSON(w http.ResponseWriter, err error)
- func WriteResponseJSON(w http.ResponseWriter, code int, body any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error returns an error that can be used to write an HTTP response with an error message and a specific status code.
func SetCacheHeaders ¶
func SetNoCacheHeaders ¶
func SetNoCacheHeaders(w http.ResponseWriter)
func WriteErrorJSON ¶
func WriteErrorJSON(w http.ResponseWriter, err error)
WriteErrorJSON writes an error response in JSON format to the provided http.ResponseWriter. If the error is an *httpError, it uses the code and error message from that error. Otherwise, it defaults to http.StatusInternalServerError, obfuscating the error message in that case.
func WriteResponseJSON ¶
func WriteResponseJSON(w http.ResponseWriter, code int, body any)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.