Documentation ¶
Index ¶
- Variables
- func Data(w http.ResponseWriter, r *http.Request, status int, v []byte)
- func HTML(w http.ResponseWriter, r *http.Request, status int, name string, v any)
- func JSON(w http.ResponseWriter, r *http.Request, status int, v any)
- func NoContent(w http.ResponseWriter, r *http.Request)
- func PureJSON(w http.ResponseWriter, r *http.Request, status int, v any)
- func Text(w http.ResponseWriter, r *http.Request, status int, v string)
- func XML(w http.ResponseWriter, r *http.Request, status int, v any)
- type ExecuteTemplate
- type M
- type S
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// HTMLEngineCtxKey is the context.Context key to store the request context.
HTMLEngineCtxKey = &contextKey{"HTMLEngine"}
)
Functions ¶
func Data ¶
Data writes raw bytes to the response, setting the Content-Type as application/octet-stream.
func JSON ¶
JSON marshals 'v' to JSON, automatically escaping HTML and setting the Content-Type as application/json.
func NoContent ¶
func NoContent(w http.ResponseWriter, r *http.Request)
NoContent returns a HTTP 204 "No Content" response.
func PureJSON ¶ added in v1.0.2
PureJSON marshals 'v' to JSON, setting the Content-Type as application/json and without escaping HTML
Types ¶
type ExecuteTemplate ¶ added in v1.0.2
func HTMLEngine ¶ added in v1.0.2
func HTMLEngine(ctx context.Context) ExecuteTemplate
Source Files ¶
Click to show internal directories.
Click to hide internal directories.