Documentation
¶
Overview ¶
curl包
func Curl(url, method string, params, header map[string]string, body []byte) (resBody map[string]interface{}, resHeader map[string][]string, responseStatus string)
Index ¶
- Constants
- func Curl(url, method string, params, header map[string]string, body []byte) (resp *client.Response, err error)
- func CurlWithClient(url, method string, params, header map[string]string, body []byte, ...) (resp *client.Response, err error)
- func HttpCurl(config HttpConfig) (resp *client.Response, err error)
- type HttpConfig
- type Request
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" HEAD = "HEAD" )
Variables ¶
This section is empty.
Functions ¶
func Curl ¶
func Curl(url, method string, params, header map[string]string, body []byte) (resp *client.Response, err error)
curl @url string 请求Uri @method string 方法。GET,POST,PUT等 @params map[string]string 参数。?a=b @header map[string]string 头部信息 @body []byte @Deprecated 建议使用 HttpCurl
Types ¶
type HttpConfig ¶
type HttpConfig struct {
// 方法。GET,POST,PUT等
Method string
// 请求Uri
Url string
// query 参数
Params map[string]string
// body内容 from或者json
Data map[string]string
Headers map[string]string
// 如果Body不为nil,则会覆盖Data数据,也就是说Body优先级高于Data
Body []byte
// contains filtered or unexported fields
}
http config
Click to show internal directories.
Click to hide internal directories.