Documentation ¶
Index ¶
- Variables
- func Data(w http.ResponseWriter, r *http.Request, v interface{})
- func HTML(w http.ResponseWriter, r *http.Request, v interface{}) error
- func JSON(w http.ResponseWriter, r *http.Request, v interface{}) error
- func PlainText(w http.ResponseWriter, r *http.Request, v interface{}) error
- func XML(w http.ResponseWriter, r *http.Request, v interface{}) error
- type Func
- type HTMLMarshaler
- type M
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrCanNotEncodeObject should be returned by RespondFunc if the Responder should // try a different content type, as we don't know how to respond with this object ErrCanNotEncodeObject = errors.New("error can not encode object") )
Functions ¶
func Data ¶
func Data(w http.ResponseWriter, r *http.Request, v interface{})
Data writes raw bytes to the response, setting the Content-Type as application/octet-stream.
func HTML ¶
func HTML(w http.ResponseWriter, r *http.Request, v interface{}) error
HTML writes a string to the response, setting the Content-Type as text/html.
func JSON ¶
func JSON(w http.ResponseWriter, r *http.Request, v interface{}) error
JSON marshals 'v' to JSON, automatically escaping HTML and setting the Content-Type as application/json.
Types ¶
type Func ¶
type Func func(http.ResponseWriter, *http.Request, interface{}) error
Func defined a function that will take an object and Marshal it into a content type before writing it to the http.ResponseWriter
type HTMLMarshaler ¶
Click to show internal directories.
Click to hide internal directories.