Documentation ¶
Index ¶
- Variables
- func Deflate() *compression
- func GetTlsConfig(cerPath, keyPath string) *tls.Config
- func Gzip() *compression
- func SetConnectTimeout(duration time.Duration)
- func Zlib() *compression
- type Body
- type Error
- type Request
- func (r *Request) AddCookie(c *http.Cookie)
- func (r *Request) AddHeader(key string, value string)
- func (r Request) Do() (*Response, error)
- func (r Request) NewRequest() (*http.Request, error)
- func (r Request) WithCookie(c *http.Cookie) Request
- func (r Request) WithHeader(key string, value string) Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultDialer DefaultDialer = &net.Dialer{Timeout: 2000 * time.Millisecond} // DefaultTransport DefaultTransport http.RoundTripper = &http.Transport{Dial: DefaultDialer.Dial, Proxy: http.ProxyFromEnvironment} // DefaultClient DefaultClient = &http.Client{Transport: DefaultTransport} )
Functions ¶
func GetTlsConfig ¶
GetTlsConfig 生成tls config
Types ¶
type Request ¶
type Request struct { Method string Url string Body interface{} Query interface{} Timeout time.Duration ContentType string XForwardedFor string Accept string UserAgent string Host string Insecure bool TlsConfig *tls.Config MaxRedirects int RedirectHeaders bool Proxy string Compression *compression BasicAuthUsername string BasicAuthPassword string CookieJar http.CookieJar ShowDebug bool OnBeforeRequest func(goxhttp *Request, httpreq *http.Request) // contains filtered or unexported fields }
Request ghttp request lib
func (Request) NewRequest ¶
NewRequest new request before do()
Click to show internal directories.
Click to hide internal directories.