http

package
v1.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(err error, code int) 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 SetCacheHeaders(w http.ResponseWriter, maxAge time.Duration, timeUntilExpiry time.Duration)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL