Documentation
¶
Index ¶
- Variables
- func DetectCode(err error) int
- func DetectError(err error) (code int, desc string)
- func Error(w http.ResponseWriter, err error)
- func HandleFunc(code int, data interface{}) func(w http.ResponseWriter, r *http.Request)
- func HandleFuncWithCode(code int) func(w http.ResponseWriter, r *http.Request)
- func Reply(w http.ResponseWriter, code int, data interface{})
- func ReplyErr(w http.ResponseWriter, code int, err string)
- func ReplyWith(w http.ResponseWriter, code int, bodyType string, msg []byte)
- func ReplyWithCode(w http.ResponseWriter, code int)
- func ReplyWithStream(w http.ResponseWriter, code int, bodyType string, body io.Reader, bytes int64)
- type ErrorInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var HTTPCodeOf = func(err error) int {
return 599
}
HTTPCodeOf func
Functions ¶
func DetectError ¶
DetectError detect error return http status code and desc
func HandleFunc ¶
func HandleFunc(code int, data interface{}) func(w http.ResponseWriter, r *http.Request)
HandleFunc return handle func width http status code and response data
func HandleFuncWithCode ¶
func HandleFuncWithCode(code int) func(w http.ResponseWriter, r *http.Request)
HandleFuncWithCode return handle func width http status code
func Reply ¶
func Reply(w http.ResponseWriter, code int, data interface{})
Reply write http status code and data to http response writer
func ReplyErr ¶
func ReplyErr(w http.ResponseWriter, code int, err string)
ReplyErr write error to http response writer with http status code
func ReplyWith ¶
func ReplyWith(w http.ResponseWriter, code int, bodyType string, msg []byte)
ReplyWith write http status code and data to http response writer with request body type
func ReplyWithCode ¶
func ReplyWithCode(w http.ResponseWriter, code int)
ReplyWithCode write http status code and data to http response writer
func ReplyWithStream ¶
ReplyWithStream write http status code and data to http response writer with request body type
Types ¶
Click to show internal directories.
Click to hide internal directories.