Documentation
¶
Index ¶
- Variables
- func CloseResponse(resp *http.Response) error
- func DoJSONRequest(ctx context.Context, url string, target interface{}) error
- func DoJSONRequestWithClient(ctx context.Context, client *http.Client, url string, target interface{}) error
- func NewRequest(ctx context.Context, url string) *http.Request
- func SendRequest(client *http.Client, req *http.Request) (*http.Response, error)
- type Dialer
- type Resolver
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NetDialer Dialer = &net.Dialer{ Timeout: connectTimeout, } DNSResolver Resolver = &net.Resolver{ Dial: NetDialer.DialContext, } CookieJar = func() *cookiejar.Jar { jar, err := cookiejar.New(nil) if err != nil { panic(err) } return jar }() HTTPClient = &http.Client{ Jar: CookieJar, Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: NetDialer.DialContext, }, Timeout: httpTimeout, } HTTPClientV4 = &http.Client{ Jar: CookieJar, Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: func(ctx context.Context, _, address string) (net.Conn, error) { return NetDialer.DialContext(ctx, "tcp4", address) }, }, Timeout: httpTimeout, } HTTPClientV6 = &http.Client{ Jar: CookieJar, Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: func(ctx context.Context, _, address string) (net.Conn, error) { return NetDialer.DialContext(ctx, "tcp6", address) }, }, Timeout: httpTimeout, } )
Functions ¶
func CloseResponse ¶
func DoJSONRequestWithClient ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.