Documentation ¶
Index ¶
- Variables
- func BuildURLWithArray(url string, params [][]string) string
- func BuildURLWithMap(url string, params map[string]string) string
- func DoRequest(client *http.Client, method, contentType, url string, content io.Reader, ...) (*http.Response, error)
- func DoUploadFile(client *http.Client, method, url string, reader io.Reader, ...) (*http.Response, error)
- func Get(url string, params map[string]string, headers map[string]string) (*http.Response, error)
- func Post(url string, params map[string]string, headers map[string]string) (*http.Response, error)
- func PostFile(url, filePath string, headers map[string]string) (*http.Response, error)
- func PostJSON(client *http.Client, method, url string, params interface{}, ...) (*http.Response, error)
- func PutFile(url, filePath string, headers map[string]string) (*http.Response, error)
- func Request4JSON(client *http.Client, method, url string, params interface{}, ...) (*http.Response, error)
- func Request4URL(client *http.Client, method, url string, params, headers map[string]string) (*http.Response, error)
Constants ¶
This section is empty.
Variables ¶
DefaultClient 默认http client
Functions ¶
func BuildURLWithArray ¶
BuildURLWithArray 使用二维数组结构构件url请求参数 [[key,value], ...] => /url/xxx?key=value
func BuildURLWithMap ¶
BuildURLWithMap 使用Map结构构件url请求参数 {key:value} => /url/xxx?key=value
func DoRequest ¶
func DoRequest(client *http.Client, method, contentType, url string, content io.Reader, header map[string]string) (*http.Response, error)
DoRequest 发送请求(client, 请求方式, Content-Type, url)
func DoUploadFile ¶
func DoUploadFile(client *http.Client, method, url string, reader io.Reader, headers map[string]string, fieldname, filename string) (*http.Response, error)
DoUploadFile 上传文件文件 form-data
func PostJSON ¶
func PostJSON(client *http.Client, method, url string, params interface{}, headers map[string]string) (*http.Response, error)
PostJSON 通过Post Json 内容发送请求
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.