Documentation ¶
Index ¶
- func Bytes(ctype string, data []byte, opts ...Option) (*router.Response, error)
- func HTML(fstr string, data interface{}, opts ...Option) (*router.Response, error)
- func JSON(body interface{}, opts ...Option) *router.Response
- func Reader(ctype string, rdr io.Reader, opts ...Option) (*router.Response, error)
- func Redirect(dest string, opts ...Option) *router.Response
- func Success(body interface{}, opts ...Option) *router.Responsedeprecated
- func Text(ctype, text string, opts ...Option) (*router.Response, error)
- type Config
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶ added in v2.6.0
Produce a successful response with a byte entity. The status code used is 200 unless otherwise specified via an option.
func HTML ¶ added in v2.1.0
Produce a successful 200 response with HTML entity content. The template string is expected to use the Go template (HTML variant) format, and it will be evaluated with the provided context value. The result of this evaluation is the response entity.
func JSON ¶ added in v2.3.0
func JSON(body interface{}, opts ...Option) *router.Response
Produce a successful response, optionally including a payload, which will be marshaled to JSON. The status code used is 200 unless otherwise specified via an option.
func Reader ¶ added in v2.6.0
Produce a successful response with a reader entity. The status code used is 200 unless otherwise specified via an option.
func Success
deprecated
func Success(body interface{}, opts ...Option) *router.Response
Produce a successful response, optionally including a payload, which will be marshaled to JSON. The status code used is 200 unless otherwise specified via an option.
Deprecated: This method has been deprecated in favor of JSON(), which it simply calls.