Documentation ¶
Index ¶
- Variables
- func HttpGet(client *http.Client, url string, header http.Header) (io.ReadCloser, error)
- func HttpGetBytes(client *http.Client, url string, header http.Header) ([]byte, error)
- func HttpGetJSON(client *http.Client, url string, header http.Header, v interface{}) error
- func HttpGetToFile(client *http.Client, url string, header http.Header, fileName string) error
- func HttpPost(client *http.Client, url string, header http.Header, body []byte) (io.ReadCloser, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1541.0 Safari/537.36"
Functions ¶
func HttpGet ¶
params := url.Values{} params.Set("code", code) //如果参数中有中文参数,这个方法会进行URLEncode Url.RawQuery = params.Encode() urlPath := Url.String()
func HttpGetBytes ¶
func HttpGetJSON ¶
HttpGetJSON gets the specified resource and mapping to struct. ErrNotFound is returned if the server responds with status 404.
func HttpGetToFile ¶
HttpGetToFile gets the specified resource and writes to file. ErrNotFound is returned if the server responds with status 404.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.