Documentation ¶
Index ¶
- type Client
- func (c *Client) CloseIdleConnections()
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) DoRequest(ctx context.Context, url, method string, headers http.Header, body io.Reader) ([]byte, error)
- func (c *Client) Get(ctx context.Context, url string) (resp *http.Response, err error)
- func (c *Client) PostForm(ctx context.Context, url string, data url.Values) (resp *http.Response, err error)
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) Timeout() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps an HTTP client and support TLS requests.
func NewClient ¶
func NewClient(credential *security.Credential) (*Client, error)
NewClient creates an HTTP client with the given Credential.
func NewTestClient ¶
func NewTestClient(t http.RoundTripper) *Client
NewTestClient creates a testing HTTP client.
func (*Client) CloseIdleConnections ¶
func (c *Client) CloseIdleConnections()
CloseIdleConnections closes any connections are now sitting idle. See http.Client.CloseIdleConnections.
func (*Client) DoRequest ¶
func (c *Client) DoRequest( ctx context.Context, url, method string, headers http.Header, body io.Reader, ) ([]byte, error)
DoRequest sends an request and returns an HTTP response content.
func (*Client) PostForm ¶
func (c *Client) PostForm( ctx context.Context, url string, data url.Values, ) (resp *http.Response, err error)
PostForm issues a POST to the specified URL, with data's keys and values URL-encoded as the request body. See http.Client.PostForm.
func (*Client) SetTimeout ¶
SetTimeout specifies a time limit for requests made by this Client. See http.Client.Timeout.
Click to show internal directories.
Click to hide internal directories.