Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPClient ¶
NewHTTPClient returns an *http.Client with the given timeout whose transport injects the CLI User-Agent header on every request.
func NewTransport ¶
func NewTransport(base http.RoundTripper, opts ...TransportOption) http.RoundTripper
NewTransport returns an http.RoundTripper that injects the CLI User-Agent header (and any extra headers from opts) before delegating to base. If base is nil, http.DefaultTransport is used.
func SetVersion ¶
func SetVersion(v string)
SetVersion records the build-time version for use in the User-Agent header.
Types ¶
type TransportOption ¶
type TransportOption func(*cliTransport)
TransportOption configures a cliTransport.
func WithHeader ¶
func WithHeader(key, value string) TransportOption
WithHeader adds a static header to every outgoing request. If value is empty the header is not set.
Click to show internal directories.
Click to hide internal directories.