Documentation ¶
Index ¶
- Constants
- Variables
- func AddRolter(r string, f func(http.ResponseWriter, *http.Request))
- func Cors(w http.ResponseWriter)
- func CreateFormRequestBody(ds map[string]string, filePath string) (string, io.Reader, error)
- func DefaultQuery(url *url.URL, key, defaultValue string) string
- func InitHttpServer(HttpListenPort, HttpsListenPort, CertFile, KeyFile string, backend bool)
- func InitHttpServerFile(...)
- func ParseJsonBody(w http.ResponseWriter, r *http.Request, v interface{}) error
- func QueryNum(url *url.URL, key string) (int, error)
- func RemoteIp(req *http.Request) string
- func SendHttpGet(url string, hk, hv []string) (string, error)
- func SendHttpGetFile(url, filepath string, hk, hv []string) error
- func SendHttpGetFileNoSuffix(url, filepath string, hk, hv []string) (string, error)
- func SendHttpGetHeader(url string, hk, hv []string) (string, http.Header, error)
- func SendHttpGetHeaderBs(url string, hk, hv []string) ([]byte, http.Header, error)
- func SendHttpGetHeaderQ(url string, hk, hv []string) (*goquery.Document, http.Header, error)
- func SendHttpGetQ(url string, hk, hv []string) (*goquery.Document, error)
- func SendHttpGetTimeout(url string, hk, hv []string, seconds int64) (string, error)
- func SendHttpPost(url string, in interface{}) (string, error)
- func SendHttpPostBinary(url string, in []byte) (string, error)
- func SendHttpPostBinaryH(url string, in []byte, hk []string, hv []string) (string, error)
- func SendHttpPostBinaryHeader(url string, in []byte, hk []string, hv []string) (string, http.Header, error)
- func SendHttpPostBinaryHeaderB(url string, in []byte, hk []string, hv []string) ([]byte, http.Header, error)
- func SendHttpPostFormHeader(url string, in io.Reader, hk []string, hv []string) ([]byte, http.Header, error)
- func SendHttpPostH(url string, in interface{}, hk []string, hv []string) (string, error)
- func SendHttpPut(url string, in []byte, hk, hv []string) error
- func SendHttpPutHeader(url string, in []byte, hk, hv []string) (http.Header, error)
- func SendHttpPutHeaderBs(url string, in []byte, hk, hv []string) ([]byte, http.Header, 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 CreateFormRequestBody ¶ added in v1.1.22
返回 Content-Type, body部分 该接口和SendHttpPostFormHeader配合使用
func InitHttpServer ¶
func InitHttpServerFile ¶ added in v1.1.15
func InitHttpServerFile(HttpListenPort, HttpsListenPort, HttpFilePort, FileRoot, CertFile, KeyFile string, backend bool)
带本地文件服务的接口
func ParseJsonBody ¶
func ParseJsonBody(w http.ResponseWriter, r *http.Request, v interface{}) error
func SendHttpGetFile ¶ added in v1.1.6
下载内容到文件
func SendHttpGetFileNoSuffix ¶ added in v1.1.12
下载内容到文件,文件不带后缀的,需要通过http请求返回的头 找到content-disposition的内容确定后缀
func SendHttpGetHeader ¶ added in v1.0.4
返回数据和头的get请求
func SendHttpGetHeaderBs ¶ added in v1.0.9
返回数据和头的get请求
func SendHttpGetHeaderQ ¶ added in v1.0.10
返回数据和头的get请求
func SendHttpGetTimeout ¶ added in v1.1.18
func SendHttpPost ¶
func SendHttpPostBinary ¶ added in v1.0.5
func SendHttpPostBinaryH ¶ added in v1.0.7
func SendHttpPostBinaryHeader ¶ added in v1.0.8
func SendHttpPostBinaryHeaderB ¶ added in v1.0.13
func SendHttpPostFormHeader ¶ added in v1.1.4
func SendHttpPostFormHeader(url string, in io.Reader, hk []string, hv []string) ([]byte, http.Header, error)
post form-data
func SendHttpPostH ¶ added in v1.0.6
func SendHttpPutHeader ¶ added in v1.1.1
func SendHttpPutHeaderBs ¶ added in v1.1.3
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.