Documentation ¶
Index ¶
- Constants
- func Error(w http.ResponseWriter, err error)
- func GetRemoteAddr(r *http.Request) string
- func Ok(w http.ResponseWriter)
- func OkJson(w http.ResponseWriter, v interface{})
- func Parse(r *http.Request, v interface{}) error
- func ParseForm(r *http.Request, v interface{}) error
- func ParseHeader(headerValue string) map[string]string
- func ParseJsonBody(r *http.Request, v interface{}) error
- func ParsePath(r *http.Request, v interface{}) error
- func SetErrorHandler(handler func(error) (int, interface{}))
- func WriteJson(w http.ResponseWriter, code int, v interface{})
- type Router
Constants ¶
View Source
const ( ApplicationJson = "application/json" ContentEncoding = "Content-Encoding" ContentSecurity = "X-Content-Security" ContentType = "Content-Type" KeyField = "key" SecretField = "secret" TypeField = "type" CryptionType = 1 )
View Source
const ( CodeSignaturePass = iota CodeSignatureInvalidHeader CodeSignatureWrongTime CodeSignatureInvalidToken )
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(w http.ResponseWriter, err error)
func GetRemoteAddr ¶
Returns the peer address, supports X-Forward-For
func Ok ¶
func Ok(w http.ResponseWriter)
func OkJson ¶
func OkJson(w http.ResponseWriter, v interface{})
func ParseHeader ¶
func ParseJsonBody ¶
Parses the post request which contains json in body.
func ParsePath ¶
Parses the symbols reside in url path. Like http://localhost/bag/:name
func SetErrorHandler ¶
func WriteJson ¶
func WriteJson(w http.ResponseWriter, code int, v interface{})
Types ¶
Click to show internal directories.
Click to hide internal directories.