Documentation ¶
Index ¶
- Variables
- func NewGoCurl() *goCurl
- type Request
- func (r *Request) Get() (*Response, error)
- func (r *Request) Post() (*Response, error)
- func (r *Request) Send() (*Response, error)
- func (r *Request) SetBody(body io.Reader) *Request
- func (r *Request) SetCookies(cookies map[string]string) *Request
- func (r *Request) SetHeaders(headers map[string]string) *Request
- func (r *Request) SetMethod(method string) *Request
- func (r *Request) SetPostData(postData map[string]interface{}) *Request
- func (r *Request) SetQueries(queries map[string]string) *Request
- func (r *Request) SetTimeOut(timeout time.Duration) *Request
- func (r *Request) SetUrl(url string) *Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var Client = (func() *http.Client { t := http.DefaultTransport.(*http.Transport).Clone() t.MaxIdleConns = 100 t.MaxConnsPerHost = 100 t.MaxIdleConnsPerHost = 100 return &http.Client{Transport: t, Timeout: clientTimeout} })()
自定义http.Client,在原来http.DefaultTransport的基础上进行性能优化 @see https://www.loginradius.com/blog/async/tune-the-go-http-client-for-high-performance
Functions ¶
Types ¶
type Request ¶
type Request struct { Method string Url string Timeout time.Duration Headers map[string]string Cookies map[string]string Queries map[string]string PostData map[string]interface{} Body io.Reader // contains filtered or unexported fields }
func NewRequest ¶
func (*Request) SetPostData ¶
func (*Request) SetQueries ¶
设置url查询参数
Click to show internal directories.
Click to hide internal directories.