Documentation ¶
Index ¶
- func NewRoundTripper(t *Transport, c ...Constructor) http.RoundTripper
- func NewTlsConfig(tc *Tls) *tls.Config
- func Unmarshal(configKey string, c ...Constructor) func(ClientUnmarshalIn) (Interface, error)
- type Chain
- type ClientUnmarshalIn
- type Constructor
- type Interface
- type Options
- type RequestHeaders
- type RoundTripperFunc
- type Tls
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRoundTripper ¶
func NewRoundTripper(t *Transport, c ...Constructor) http.RoundTripper
NewRoundTripper assembles an http.RoundTripper given a set of configuration options. The returned round tripper will be backed by an http.Transport, decorated with any constructors that were supplied. If the Transport options is nil, a default http.Transport is used.
func NewTlsConfig ¶
NewTlsConfig assembles a *tls.Config for clients given a set of configuration options. If the Tls options is nil, this method returns nil, nil.
func Unmarshal ¶
func Unmarshal(configKey string, c ...Constructor) func(ClientUnmarshalIn) (Interface, error)
Unmarshal returns an uber/fx provider than in turn unmarshals client options and produces a client object. If multiple client objects need to coexist in the same uber/fx App, use fx.Annotated with this function.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain is a sequence of Constructors, just like github.com/justinas/alice.Chain
func NewChain ¶
func NewChain(c ...Constructor) Chain
func (Chain) Append ¶
func (ch Chain) Append(more ...Constructor) Chain
func (Chain) Then ¶
func (ch Chain) Then(rt http.RoundTripper) http.RoundTripper
func (Chain) ThenFunc ¶
func (ch Chain) ThenFunc(rtf RoundTripperFunc) http.RoundTripper
type ClientUnmarshalIn ¶
type ClientUnmarshalIn struct { fx.In Unmarshaller config.Unmarshaller // Chain is an optional component. If present in the application, this chain // will be used to decorate the roundtripper. Any constructors passed to Unmarshal // will be appended to this chain. // // Using this component allows for global decorators that apply to all clients. Chain Chain `optional:"true"` }
ClientUnmarshalIn defines the set of dependencies for an HTTP client
type Constructor ¶
type Constructor func(http.RoundTripper) http.RoundTripper
Constructor is an Alice-style constructor for RoundTrippers
type Interface ¶
Interface defines the behavior of an HTTP client. *http.Client implements this interface.
func New ¶
func New(o Options, c ...Constructor) Interface
New assembles an http client from a set of configuration options
type RequestHeaders ¶
RequestHeaders provides a RoundTripper constructor that inserts a constant set of headers into each request
func (RequestHeaders) Then ¶
func (rh RequestHeaders) Then(next http.RoundTripper) http.RoundTripper
func (RequestHeaders) ThenFunc ¶
func (rh RequestHeaders) ThenFunc(next RoundTripperFunc) http.RoundTripper
type RoundTripperFunc ¶
type Tls ¶
type Tls struct {
InsecureSkipVerify bool
}
Tls represents the set of configurable options for client-side TLS
type Transport ¶
type Transport struct { DisableKeepAlives bool DisableCompression bool MaxIdleConns int MaxIdleConnsPerHost int MaxConnsPerHost int IdleConnTimeout time.Duration ResponseHeaderTimeout time.Duration ExpectContinueTimeout time.Duration MaxResponseHeaderBytes int64 TlsHandshakeTimeout time.Duration Tls *Tls // Header is a set of static HTTP headers added to every request Header http.Header }
Transport represents the set of configurable options for a client RoundTripper The majority of these fields map directory to an http.Transport. See https://godoc.org/net/http#Transport