Documentation
¶
Index ¶
- Constants
- Variables
- func PrepareURL(url string) string
- type Client
- func (c *Client) Close()
- func (c *Client) Get(url string) (*http.Response, error)
- func (c *Client) GetClient() *http.Client
- func (c *Client) GetWithBasicAuth(url string, body []byte, user, pass string) ([]byte, error)
- func (c *Client) Post(url string, body []byte) (*http.Response, error)
- func (c *Client) PostDAS(url string, body []byte) ([]byte, error)
- func (c *Client) PostWithBasicAuth(url string, body []byte, user, pass string) ([]byte, error)
- func (c *Client) SendRequestWithBasicAuth(method, url string, body []byte, user, pass string) ([]byte, error)
- func (c *Client) SetMaxIdleConns(maxIdleConns int)
- func (c *Client) SetMaxIdleConnsPerHost(maxIdleConnsPerHost int)
- func (c *Client) SetRetryOption(maxWaitTime, maxRetryCount, delay int)
Constants ¶
View Source
const ( MethodGet = http.MethodGet MethodPost = http.MethodPost StatusOK = http.StatusOK StatusInternalServerError = http.StatusInternalServerError DefaultMaxWaitTime = 60 // seconds DefaultMaxRetryCount = 3 DefaultDelayTime = 10 // milliseconds DefaultUnlimitedWaitTime = -1 // seconds DefaultUnlimitedRetryCount = -1 )
Variables ¶
View Source
var ( DefaultTransport = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{Timeout: defaultDialTimeout, KeepAlive: defaultKeepAlive}).DialContext, TLSHandshakeTimeout: defaultTLSHandshakeTimeout, ForceAttemptHTTP2: true, MaxIdleConns: defaultMaxIdleConns, IdleConnTimeout: defaultIdleConnTimeout, ExpectContinueTimeout: defaultExpectContinueTimeout, MaxIdleConnsPerHost: defaultMaxIdleConnsPerHost, } )
Functions ¶
func PrepareURL ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithDefault ¶
func NewClientWithRetry ¶
func (*Client) GetWithBasicAuth ¶
func (*Client) PostWithBasicAuth ¶
func (*Client) SendRequestWithBasicAuth ¶
func (*Client) SetMaxIdleConns ¶
func (*Client) SetMaxIdleConnsPerHost ¶
func (*Client) SetRetryOption ¶
Click to show internal directories.
Click to hide internal directories.