Documentation ¶
Overview ¶
curl包
func Do(url, method string, params, header map[string]string, body []byte) (resBody map[string]interface{}, resHeader map[string][]string, responseStatus string)
Index ¶
- Constants
- func Do(url, method string, params, header map[string]string, body []byte) (resp *core.Response, err error)
- func DoWithClient(url, method string, params, header map[string]string, body []byte, ...) (resp *core.Response, err error)
- func HttpCurl(config HttpConfig) (resp *core.Response, err error)
- type HttpConfig
- type Request
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" HEAD = "HEAD" )
View Source
const ( ContentTypeJson = "application/json" ContentTypeFormDate = "application/x-www-form-urlencoded" )
Variables ¶
This section is empty.
Functions ¶
func Do ¶
func Do(url, method string, params, header map[string]string, body []byte) (resp *core.Response, err error)
@url string 请求Uri @method string 方法。GET,POST,PUT等 @params map[string]string 参数。?a=b @header map[string]string 头部信息 @body []byte @notice 建议使用 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.