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) PrepareURL(scheme, addr, path string, params map[string]string) string
- func (c *Client) SendRequestWithBasicAuth(method, url string, body []byte, user, pass string) ([]byte, error)
- func (c *Client) SendRequestWithHeaderAndBody(method, url string, header map[string]string, body []byte) ([]byte, error)
- func (c *Client) SetMaxIdleConns(maxIdleConns int)
- func (c *Client) SetMaxIdleConnsPerHost(maxIdleConnsPerHost int)
- func (c *Client) SetRetryOption(maxWaitTime, maxRetryCount, delay int)
- func (c *Client) SetTLSInsecureSkipVerify(skip bool) error
- type Request
- type Response
Constants ¶
View Source
const ( HTTPSchemeStr = "http" HTTPSSchemeStr = "https" MethodGet = http.MethodGet MethodPost = http.MethodPost DefaultContentTypeKey = "Content-Type" DefaultContentTypeValue = "application/json" 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, TLSClientConfig: &tls.Config{}, 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) PrepareURL ¶ added in v0.3.18
PrepareURL prepares the url
func (*Client) SendRequestWithBasicAuth ¶
func (*Client) SendRequestWithHeaderAndBody ¶ added in v0.3.18
func (*Client) SetMaxIdleConns ¶
func (*Client) SetMaxIdleConnsPerHost ¶
func (*Client) SetRetryOption ¶
func (*Client) SetTLSInsecureSkipVerify ¶ added in v0.3.18
SetTLSInsecureSkipVerify sets TLS insecure skip verify
Click to show internal directories.
Click to hide internal directories.