Documentation ¶
Index ¶
- func New(opts ...Option) *http.Client
- func NewClient(config Config) *http.Client
- func NewPooledClient(config Config) *http.Client
- type Client
- type Config
- type Option
- func WithCircuitBreaker() Option
- func WithConnectTimeout(timeout int) Option
- func WithKeepAliveTimeout(timeout int) Option
- func WithMaxIdleConnections(count int) Option
- func WithPooledTransport(maxIdleConnectionsPerHost int) Option
- func WithRequestTimeout(timeout int) Option
- func WithTimeout(timeout int) Option
- func WithTlsConfig(tlsConfig *tls.Config) Option
- func WithTransport(t http.RoundTripper) Option
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
NewClient returns a new clean HTTP.Client with timeouts (default 1s for connection and request), disabled idle connections and disabled keep-alives
func NewPooledClient ¶
NewPooledClient returns a new clean HTTP.Client with timeouts (default 1s for connection and request) and shared transport across hosts with keepalive on, you can set the number of idle connections per host with Config.MaxIdleConnsPerHost (default 1)
Types ¶
type Config ¶
type Config struct { ConnectTimeout int RequestTimeout int KeepAliveTimeout int MaxIdleConnectionsPerHost int KeepAlive bool // contains filtered or unexported fields }
Config defines timeouts and max idle connections per host if pooled transport is used all timeouts are seconds
type Option ¶ added in v0.2.0
type Option func(c *Config)
func WithCircuitBreaker ¶ added in v0.3.0
func WithCircuitBreaker() Option
func WithConnectTimeout ¶ added in v0.2.0
func WithKeepAliveTimeout ¶ added in v0.2.0
func WithMaxIdleConnections ¶ added in v0.2.0
func WithPooledTransport ¶ added in v0.4.0
func WithRequestTimeout ¶ added in v0.2.0
func WithTimeout ¶ added in v0.2.0
WithTimeout sets all timeouts to the provided value in seconds
func WithTlsConfig ¶ added in v0.2.1
func WithTransport ¶ added in v0.4.0
func WithTransport(t http.RoundTripper) Option
type Transport ¶ added in v0.3.0
type Transport struct {
// contains filtered or unexported fields
}
func DefaultPooledTransport ¶
func DefaultTransport ¶
Click to show internal directories.
Click to hide internal directories.