Documentation
¶
Index ¶
- func DownloadToFile(filename, url string, tryTime int) error
- func ParseReader(reader io.Reader) gjson.Result
- type HttpClient
- func (c *HttpClient) AddCookie(cookie ...*http.Cookie)
- func (c HttpClient) Do(req *http.Request) (*http.Response, error)
- func (c *HttpClient) DownloadToFile(filename, url string) error
- func (c HttpClient) Get(url string) (*http.Response, error)
- func (c HttpClient) GetGJson(url string) (gjson.Result, error)
- func (c HttpClient) GetReader(url string) (io.ReadCloser, error)
- func (c HttpClient) Head(url string) (*http.Response, error)
- func (c HttpClient) Post(url, contentType string, body io.Reader) (*http.Response, error)
- func (c HttpClient) PostForm(url string, data url.Values) (resp *http.Response, err error)
- func (c HttpClient) PostFormByMap(URL string, data map[string]string) (resp *http.Response, err error)
- func (c HttpClient) PostJson(url string, data interface{}) (gjson.Result, error)
- func (c HttpClient) PostMarshal(url string, data interface{}, response interface{}) error
- func (c *HttpClient) SetHeader(key string, val string)
- func (c *HttpClient) SetUserAgent()
- type HttpOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadToFile ¶ added in v0.1.0
DownloadToFile 下载文件,并返回其绝对路径
Types ¶
type HttpClient ¶
type HttpClient struct { HttpOptions // contains filtered or unexported fields }
func (*HttpClient) AddCookie ¶ added in v0.1.0
func (c *HttpClient) AddCookie(cookie ...*http.Cookie)
func (*HttpClient) DownloadToFile ¶ added in v0.1.0
func (c *HttpClient) DownloadToFile(filename, url string) error
DownloadToFile 下载文件,并返回其绝对路径
func (HttpClient) GetGJson ¶ added in v0.1.0
func (c HttpClient) GetGJson(url string) (gjson.Result, error)
GetGJson 通过Get请求获取回包Body(gjson.Result)
func (HttpClient) GetReader ¶
func (c HttpClient) GetReader(url string) (io.ReadCloser, error)
GetReader 通过Get请求获取回包Body(io.Reader)
func (HttpClient) Head ¶ added in v0.3.1
func (c HttpClient) Head(url string) (*http.Response, error)
Head 发送Head请求
func (HttpClient) PostFormByMap ¶ added in v0.1.0
func (HttpClient) PostJson ¶ added in v0.1.0
func (c HttpClient) PostJson(url string, data interface{}) (gjson.Result, error)
func (HttpClient) PostMarshal ¶ added in v0.1.0
func (c HttpClient) PostMarshal(url string, data interface{}, response interface{}) error
func (*HttpClient) SetHeader ¶ added in v0.1.0
func (c *HttpClient) SetHeader(key string, val string)
func (*HttpClient) SetUserAgent ¶ added in v0.1.0
func (c *HttpClient) SetUserAgent()
Click to show internal directories.
Click to hide internal directories.