Documentation ¶
Index ¶
Constants ¶
const ( // DefaultAPICacheMaxAge represents the default cache duration used by some // API endpoints. DefaultAPICacheMaxAge = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func BuildCacheControlHeader ¶
BuildCacheControlHeader builds an http cache header using the max age duration provided.
func RenderErrorJSON ¶ added in v0.2.0
func RenderErrorJSON(w http.ResponseWriter, err error)
RenderErrorJSON is a helper to write the error provided to the given http response writer as json setting the appropriate content type.
func RenderErrorWithCodeJSON ¶ added in v0.2.0
func RenderErrorWithCodeJSON(w http.ResponseWriter, err error, code int)
RenderErrorWithCodeJSON is a helper to write the error provided to the given http response writer as json setting the appropriate content type. Unlike RenderErrorJSON, which decides what status code to use based on the type of the error provided, this methods expects the status code and the error msg will be always sent to the requester.
func RenderJSON ¶
RenderJSON is a helper to write the json data provided to the given http response writer, setting the appropriate content type, cache and status code.
Types ¶
This section is empty.