Documentation ¶
Index ¶
- Variables
- type ClientIF
- type Request
- func (r *Request) AddHeaders(header http.Header) RequestIF
- func (r *Request) Delete(oUrl string, oParams ...interface{}) (*Response, error)
- func (r *Request) DialContext(fn func(ctx context.Context, network, addr string) (net.Conn, error)) RequestIF
- func (r *Request) Download(oUrl string, toFile string) error
- func (r *Request) ExecTime() time.Duration
- func (r *Request) Get(oUrl string, oParams ...interface{}) (*Response, error)
- func (r *Request) GetHeader(key string) string
- func (r *Request) GetHost(host string) string
- func (r *Request) Head(oUrl string, oParams ...interface{}) (*Response, error)
- func (r *Request) Options(oUrl string, oParams ...interface{}) (*Response, error)
- func (r *Request) Post(oUrl string, oParams ...interface{}) (*Response, error)
- func (r *Request) PostForm(oUrl string, oParams ...interface{}) (*Response, error)
- func (r *Request) Put(oUrl string, oParams ...interface{}) (*Response, error)
- func (r *Request) Reset() RequestIF
- func (r *Request) SetCharset(charset string) RequestIF
- func (r *Request) SetCookieJar(jar http.CookieJar) RequestIF
- func (r *Request) SetDialTimeout(t time.Duration) RequestIF
- func (r *Request) SetHeader(key, val string) RequestIF
- func (r *Request) SetHeaders(header http.Header) RequestIF
- func (r *Request) SetHost(host string) RequestIF
- func (r *Request) SetInsecureSkipVerify(s bool) RequestIF
- func (r *Request) SetProxy(proxy string) RequestIF
- func (r *Request) SetRedirectHandler(handler redirectHandler) RequestIF
- func (r *Request) SetRedirectTimes(t int) RequestIF
- func (r *Request) SetReferer(referer string) RequestIF
- func (r *Request) SetResponseHeaderTimeout(t time.Duration) RequestIF
- func (r *Request) SetTLSTimeout(t time.Duration) RequestIF
- func (r *Request) SetTimeout(t time.Duration) RequestIF
- func (r *Request) SetUserAgent(ua string) RequestIF
- func (r *Request) Suck(oMethod, oUrl string, oParams ...interface{}) (*Response, error)
- type RequestIF
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var CtPool = sync.Pool{ New: func() interface{} { return &http.Client{} }, }
Http client pool
Functions ¶
This section is empty.
Types ¶
type Request ¶
func NewRequest ¶
func NewRequest() *Request
func (*Request) DialContext ¶
func (r *Request) DialContext(fn func(ctx context.Context, network, addr string) (net.Conn, error)) RequestIF
指定创建TCP连接的拨号函数
func (*Request) SetCookieJar ¶
设置CookieJar
func (*Request) SetDialTimeout ¶
设置TCP连接超时时间
func (*Request) SetInsecureSkipVerify ¶
SSL 不校验服务器证书
func (*Request) SetProxy ¶
设置代理地址 proxy http://127.0.0.1:8081
func (*Request) SetRedirectHandler ¶
自定义重定向Handler
func (*Request) SetResponseHeaderTimeout ¶
设置读取ResponseHeader超时时间
func (*Request) SetTLSTimeout ¶
设置TLS握手超时时间
type RequestIF ¶
type RequestIF interface { Get(oUrl string, oParams ...interface{}) (*Response, error) Post(oUrl string, oParams ...interface{}) (*Response, error) PostForm(oUrl string, oParams ...interface{}) (*Response, error) Put(oUrl string, oParams ...interface{}) (*Response, error) Head(oUrl string, oParams ...interface{}) (*Response, error) Options(oUrl string, oParams ...interface{}) (*Response, error) Delete(oUrl string, oParams ...interface{}) (*Response, error) Suck(oMethod, oUrl string, oParams ...interface{}) (*Response, error) Download(oUrl string, toFile string) error SetHost(host string) RequestIF GetHost(host string) string SetProxy(proxy string) RequestIF SetRedirectTimes(t int) RequestIF SetRedirectHandler(handler redirectHandler) RequestIF SetInsecureSkipVerify(s bool) RequestIF SetCookieJar(jar http.CookieJar) RequestIF DialContext(fn func(ctx context.Context, network, addr string) (net.Conn, error)) RequestIF SetReferer(referer string) RequestIF SetCharset(charset string) RequestIF SetUserAgent(ua string) RequestIF SetHeader(key, val string) RequestIF GetHeader(key string) string SetHeaders(header http.Header) RequestIF AddHeaders(header http.Header) RequestIF SetTimeout(t time.Duration) RequestIF SetDialTimeout(t time.Duration) RequestIF SetTLSTimeout(t time.Duration) RequestIF SetResponseHeaderTimeout(t time.Duration) RequestIF Reset() RequestIF ExecTime() time.Duration }
Request Interface
Click to show internal directories.
Click to hide internal directories.