Documentation ¶
Index ¶
- Constants
- func GetUrlParam(ul, key string) string
- func HttpBuildQuery(values lib.InRow) string
- func SaveRemoteFile(remoteFile, localFullName string) bool
- func UrlDecode(queryString string) string
- func UrlEncode(queryString string) string
- type HttpClient
- func (h *HttpClient) Connect(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) Delete(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) Get(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) Head(url string) *HttpResponse
- func (h *HttpClient) Options(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) Patch(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) Post(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) PostJson(url string, value interface{}) *HttpResponse
- func (h *HttpClient) PostMultipart(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) PostXml(url string, value interface{}) *HttpResponse
- func (h *HttpClient) Put(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) Trace(url string, values lib.InRow) *HttpResponse
- func (h *HttpClient) WithCookie(cookies ...*http.Cookie) Httper
- func (h *HttpClient) WithHeader(key string, value interface{}) Httper
- func (h *HttpClient) WithHeaders(header lib.InRow) Httper
- func (h *HttpClient) WithOption(key int, value interface{}) Httper
- func (h *HttpClient) WithOptions(options lib.IntRow) Httper
- func (h *HttpClient) WithProxy(proto int, host, port string) Httper
- func (h *HttpClient) WithRequestBefore(fun RequestBeforeFunc) Httper
- func (h *HttpClient) WithSSL(certpemPath, keypemPath, rootcaName string) Httper
- func (h *HttpClient) WithTimeOut(timeout int) Httper
- type HttpResponse
- type Httper
- type RequestBeforeFunc
Constants ¶
View Source
const ( OPT_SSL int = iota OPT_PROXY PROXY_SOCKS4 PROXY_SOCKS5 PROXY_SOCKS4A PROXY_HTTP PROXY_HTTPS OPT_TIMEOUT )
Variables ¶
This section is empty.
Functions ¶
func HttpBuildQuery ¶
HttpBuildQuery 生成 URL-encode 之后的请求字符串
func SaveRemoteFile ¶
保存远程文件到本地 remoteFile远程文件地址 localFullName本地文件地址
Types ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
Http 类
func (*HttpClient) Connect ¶
func (h *HttpClient) Connect(url string, values lib.InRow) *HttpResponse
Connect 请求
func (*HttpClient) Delete ¶
func (h *HttpClient) Delete(url string, values lib.InRow) *HttpResponse
Delete 请求
func (*HttpClient) Get ¶
func (h *HttpClient) Get(url string, values lib.InRow) *HttpResponse
Get 请求
func (*HttpClient) Options ¶
func (h *HttpClient) Options(url string, values lib.InRow) *HttpResponse
Options 请求
func (*HttpClient) Patch ¶
func (h *HttpClient) Patch(url string, values lib.InRow) *HttpResponse
Patch 请求
func (*HttpClient) Post ¶
func (h *HttpClient) Post(url string, values lib.InRow) *HttpResponse
Post 请求
func (*HttpClient) PostJson ¶
func (h *HttpClient) PostJson(url string, value interface{}) *HttpResponse
PostJson 请求json
func (*HttpClient) PostMultipart ¶
func (h *HttpClient) PostMultipart(url string, values lib.InRow) *HttpResponse
PostMultipart 请求提交文件
func (*HttpClient) PostXml ¶
func (h *HttpClient) PostXml(url string, value interface{}) *HttpResponse
PostXml 请求xml
func (*HttpClient) Put ¶
func (h *HttpClient) Put(url string, values lib.InRow) *HttpResponse
Put 请求
func (*HttpClient) Trace ¶
func (h *HttpClient) Trace(url string, values lib.InRow) *HttpResponse
Trace 请求
func (*HttpClient) WithCookie ¶
func (h *HttpClient) WithCookie(cookies ...*http.Cookie) Httper
WithCookie 自定义cookie
func (*HttpClient) WithHeader ¶
func (h *HttpClient) WithHeader(key string, value interface{}) Httper
WithHeader 自定义头
func (*HttpClient) WithHeaders ¶
func (h *HttpClient) WithHeaders(header lib.InRow) Httper
WithHeaders 自定义头
func (*HttpClient) WithOption ¶
func (h *HttpClient) WithOption(key int, value interface{}) Httper
WithOption 自定义选项
func (*HttpClient) WithOptions ¶
func (h *HttpClient) WithOptions(options lib.IntRow) Httper
WithOption 自定义选项
func (*HttpClient) WithProxy ¶
func (h *HttpClient) WithProxy(proto int, host, port string) Httper
WithProxy 代理
func (*HttpClient) WithRequestBefore ¶
func (h *HttpClient) WithRequestBefore(fun RequestBeforeFunc) Httper
WithRequestBefore 请求前调用
func (*HttpClient) WithSSL ¶
func (h *HttpClient) WithSSL(certpemPath, keypemPath, rootcaName string) Httper
WithSSL 设置证书
func (*HttpClient) WithTimeOut ¶
func (h *HttpClient) WithTimeOut(timeout int) Httper
WithTimeOut 超时时间 单位秒
type HttpResponse ¶
type HttpResponse struct { Code int `json:"code"` Err string `json:"err"` BodyByte []byte `json:"bodybyte"` Header http.Header Dump string `json:"dump"` }
HttpResponse 响应内容
type Httper ¶
type Httper interface { WithHeader(key string, value interface{}) Httper WithHeaders(header lib.InRow) Httper WithOption(key int, value interface{}) Httper WithOptions(options lib.IntRow) Httper WithCookie(cookies ...*http.Cookie) Httper WithSSL(certpemPath, keypemPath, rootcaName string) Httper WithProxy(proto int, host, port string) Httper WithTimeOut(timeout int) Httper Get(url string, values lib.InRow) *HttpResponse Put(url string, values lib.InRow) *HttpResponse Post(url string, values lib.InRow) *HttpResponse PostJson(url string, value interface{}) *HttpResponse PostXml(url string, value interface{}) *HttpResponse PostMultipart(url string, values lib.InRow) *HttpResponse Delete(url string, values lib.InRow) *HttpResponse Options(url string, values lib.InRow) *HttpResponse Head(url string) *HttpResponse Connect(url string, values lib.InRow) *HttpResponse Trace(url string, values lib.InRow) *HttpResponse Patch(url string, values lib.InRow) *HttpResponse WithRequestBefore(fun RequestBeforeFunc) Httper }
Httper http请求
Click to show internal directories.
Click to hide internal directories.