Documentation
¶
Index ¶
- func Attachment(w http.ResponseWriter, filename string, data []byte)
- func JSON(w http.ResponseWriter, statusCode int, data ...interface{})
- func JSONCustom(w http.ResponseWriter, code Code, data ...interface{})
- func JSONDetail(w http.ResponseWriter, err error, data ...interface{})
- func JSONs(w http.ResponseWriter, httpCode int, code Code, data ...interface{})
- type Code
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attachment ¶ added in v0.2.4
func Attachment(w http.ResponseWriter, filename string, data []byte)
Attachment attachment application/octet-stream;charset=utf-8
func JSON ¶
func JSON(w http.ResponseWriter, statusCode int, data ...interface{})
JSON 返回json信息,带标准回复
func JSONCustom ¶
func JSONCustom(w http.ResponseWriter, code Code, data ...interface{})
JSONCustom http.StatusBadRequest式应答,自定义code,提供给前端
func JSONDetail ¶
func JSONDetail(w http.ResponseWriter, err error, data ...interface{})
JSONDetail http.StatusBadRequest式应答,含detail字段,用于debug
Types ¶
Click to show internal directories.
Click to hide internal directories.