Documentation
¶
Index ¶
- Constants
- func Accepted(r *http.Request) []string
- func JSON(code int, w http.ResponseWriter, obj any) error
- func MsgPack(code int, w http.ResponseWriter, obj msgp.Encodable) error
- func ParseAccept(acceptHeader string) []string
- func Text(code int, w http.ResponseWriter, text string) error
- func Textf(code int, w http.ResponseWriter, text string, a ...any) error
- type Renderer
Constants ¶
View Source
const ( Accept = "Accept" ContentType = "Content-Type" )
Header keys for http requests and responses
Variables ¶
This section is empty.
Functions ¶
func JSON ¶
func JSON(code int, w http.ResponseWriter, obj any) error
JSON marshals the given interface object and writes it with the correct ContentType.
func MsgPack ¶
MsgPack marshals the given interface object to the binary MessagePack representation and writes it to the response with the correct ContentType
func ParseAccept ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.