Documentation ¶
Index ¶
- Constants
- Variables
- func AddRolter(r string, f func(http.ResponseWriter, *http.Request))
- func Cors(w http.ResponseWriter)
- func DefaultQuery(url *url.URL, key, defaultValue string) string
- func InitHttpServer(HttpListenPort, HttpsListenPort, CertFile, KeyFile string, backend bool)
- func ParseJsonBody(w http.ResponseWriter, r *http.Request, v interface{}) error
- func QueryNum(url *url.URL, key string) (int, error)
- func SendHttpGet(url string, hk, hv []string) (string, error)
- func SendHttpGetHeader(url string, hk, hv []string) (string, http.Header, error)
- func SendHttpGetQ(url string, hk, hv []string) (*goquery.Document, error)
- func SendHttpPost(url string, in interface{}) (string, error)
- func WriteError(w http.ResponseWriter, r *http.Request, rd interface{})
- type MyHandler
- type ResponDData
- type ResponeBase
- type ResponeData
Constants ¶
View Source
const ( TOKEN_EXPIRES = -20 // token 过期 RESPONSE_ERROR = -10 // 请求错误 RESPONSE_OK = 0 // 请求成功 )
Variables ¶
View Source
var Mux map[string]func(w http.ResponseWriter, r *http.Request)
Functions ¶
func Cors ¶ added in v1.0.1
func Cors(w http.ResponseWriter)
func InitHttpServer ¶
func ParseJsonBody ¶
func ParseJsonBody(w http.ResponseWriter, r *http.Request, v interface{}) error
func SendHttpGetHeader ¶ added in v1.0.4
返回数据和头的get请求
func SendHttpPost ¶
func WriteError ¶
func WriteError(w http.ResponseWriter, r *http.Request, rd interface{})
Types ¶
type ResponDData ¶
type ResponDData struct {
Time string `json:"time"`
}
type ResponeBase ¶
type ResponeData ¶
type ResponeData struct { ResponeBase Data ResponDData `json:"data"` }
Click to show internal directories.
Click to hide internal directories.