Documentation ¶
Index ¶
- type Client
- func (o *Client) ApplyOptions(options ...ClientOption) *Client
- func (c *Client) Get(url string) ([]byte, error)
- func (c *Client) Post(url, contentType string, headers map[string]string, body []byte) ([]byte, error)
- func (c *Client) PostJson(url string, headers map[string]string, body []byte) ([]byte, error)
- func (c *Client) PostJsonWithAuthorize(url string, headers map[string]string, auth func(r *http.Request) error, ...) ([]byte, error)
- func (c *Client) PostReader(url, contentType string, headers map[string]string, ...) ([]byte, error)
- type ClientOption
- func WithDisableKeepAlives(disableKeepAlives bool) ClientOption
- func WithIdleConnTimeout(idleConnTimeout time.Duration) ClientOption
- func WithLogger(l *log.Logger) ClientOption
- func WithMaxIdleConns(maxIdleConns int) ClientOption
- func WithResonseHeaderTimeout(responseHeaderTimeout time.Duration) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- type ClientOptionFunc
- type EmptyClientOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewClient ¶
func NewClient(options ...ClientOption) (*Client, error)
func (*Client) ApplyOptions ¶
func (o *Client) ApplyOptions(options ...ClientOption) *Client
func (*Client) PostJsonWithAuthorize ¶ added in v0.0.14
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
A ClientOption sets options.
func WithDisableKeepAlives ¶
func WithDisableKeepAlives(disableKeepAlives bool) ClientOption
func WithIdleConnTimeout ¶
func WithIdleConnTimeout(idleConnTimeout time.Duration) ClientOption
func WithMaxIdleConns ¶
func WithMaxIdleConns(maxIdleConns int) ClientOption
func WithResonseHeaderTimeout ¶
func WithResonseHeaderTimeout(responseHeaderTimeout time.Duration) ClientOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
type ClientOptionFunc ¶
type ClientOptionFunc func(*Client)
ClientOptionFunc wraps a function that modifies Client into an implementation of the ClientOption interface.
type EmptyClientOption ¶
type EmptyClientOption struct{}
EmptyClientOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
Click to show internal directories.
Click to hide internal directories.