Documentation ¶
Index ¶
- type C
- type R
- func (r *R) DownloadFile(url string, path string) error
- func (r *R) DownloadImage(url string, path string) error
- func (r *R) GetToBody(url string) (io.ReadCloser, error)
- func (r *R) GetToResp(url string) (*http.Response, error)
- func (r *R) GetToString(url string) (string, error)
- func (r *R) GetToStringWithHeader(url string) (string, http.Header, error)
- func (r *R) PostToString(url string) (string, error)
- func (r *R) SetHeader(header map[string]string) *R
- func (r *R) SetParameter(p map[string]interface{}) *R
- func (r *R) SetReTryTimes(times int) *R
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type C ¶ added in v0.2.21
type C struct { Transport *http.Transport Header map[string]string //全局头部 // contains filtered or unexported fields }
C 客户端结构体
func (*C) SetProxyAddress ¶ added in v0.2.23
SetProxyAddress 设置代理地址
type R ¶ added in v0.2.21
type R struct { Request *http.Request Parameter map[string]interface{} //参数 Header map[string]string //header ReTryTimes int //重试次数 // contains filtered or unexported fields }
R request构造体
func (*R) DownloadFile ¶ added in v0.2.21
DownloadFile 下载文件
func (*R) DownloadImage ¶ added in v0.2.21
DownloadImage 图片下载
func (*R) GetToBody ¶ added in v0.2.21
func (r *R) GetToBody(url string) (io.ReadCloser, error)
GetToBody 注意要手动关闭body
func (*R) GetToStringWithHeader ¶ added in v0.2.21
GetToStringWithHeader get获取字符串结果并返回头部信息
func (*R) PostToString ¶ added in v0.2.21
PostToString post获取字符串结果
func (*R) SetParameter ¶ added in v0.2.21
SetParameter 设置请求参数
func (*R) SetReTryTimes ¶ added in v0.2.26
SetReTryTimes 设置重试次数
Click to show internal directories.
Click to hide internal directories.