Documentation ¶
Index ¶
- Constants
- func GetRealIP(req *http.Request) (ip string)
- func HTMLEscape(url string) string
- func HTMLUnEscape(url string) string
- func ListenAndServe(addr string, router http.Handler)
- func ListenAndServeTLS(addr, certFile, keyFile string, router http.Handler)
- func NotAllowedHandler(w http.ResponseWriter, req *http.Request)
- func NotFoundHandler(w http.ResponseWriter, req *http.Request)
- func PanicHandler(w http.ResponseWriter, r *http.Request, err interface{})
- func Redirect(w http.ResponseWriter, url string)
- func ResponseJSON(reply *tyr.ReplyData, req *http.Request, w http.ResponseWriter) error
- func SetCookie(w http.ResponseWriter, name, value, path string, maxAge int)
- func WriteBytes(w http.ResponseWriter, response interface{}) error
- func WriteCtxBytes(ctx context.Context, w http.ResponseWriter, response interface{}) error
- func WriteCtxJSON(ctx context.Context, w http.ResponseWriter, response interface{}) error
- func WriteCtxXML(ctx context.Context, w http.ResponseWriter, response interface{}) error
- func WriteJSON(w http.ResponseWriter, response interface{}) error
- func WriteXML(w http.ResponseWriter, response interface{}) error
- type Message
Constants ¶
View Source
const (
// RequestTimeOut http request timeout (second)
RequestTimeOut = 30
)
Variables ¶
This section is empty.
Functions ¶
func HTMLEscape ¶
HTMLEscape html special char convert
space to ", & to &, < to <, > to >
func HTMLUnEscape ¶
HTMLUnEscape html special char convert
" to space, & to &, < to <, > to >
func ListenAndServe ¶
ListenAndServe new server and start
func ListenAndServeTLS ¶
ListenAndServeTLS new server and start
func NotAllowedHandler ¶
func NotAllowedHandler(w http.ResponseWriter, req *http.Request)
NotAllowedHandler 405
func NotFoundHandler ¶
func NotFoundHandler(w http.ResponseWriter, req *http.Request)
NotFoundHandler 404
func PanicHandler ¶
func PanicHandler(w http.ResponseWriter, r *http.Request, err interface{})
PanicHandler panic router
func ResponseJSON ¶
ResponseJSON reply JSON
func SetCookie ¶
func SetCookie(w http.ResponseWriter, name, value, path string, maxAge int)
SetCookie set http cookie
func WriteBytes ¶
func WriteBytes(w http.ResponseWriter, response interface{}) error
WriteBytes response bytes
func WriteCtxBytes ¶
func WriteCtxBytes(ctx context.Context, w http.ResponseWriter, response interface{}) error
WriteCtxBytes response text data.
func WriteCtxJSON ¶
func WriteCtxJSON(ctx context.Context, w http.ResponseWriter, response interface{}) error
WriteCtxJSON response JSON data.
func WriteCtxXML ¶
func WriteCtxXML(ctx context.Context, w http.ResponseWriter, response interface{}) error
WriteCtxXML response XML data.
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, response interface{}) error
WriteJSON response JSON data.
func WriteXML ¶
func WriteXML(w http.ResponseWriter, response interface{}) error
WriteXML response XML data.
Types ¶
Click to show internal directories.
Click to hide internal directories.