Documentation
¶
Index ¶
- func NewHTTPClient(opts ...HTTPOption) *http.Client
- type HTTPOption
- func WithHTTPCheckRedirect(checkRedirect func(req *http.Request, via []*http.Request) error) HTTPOption
- func WithHTTPCookieJar(jar http.CookieJar) HTTPOption
- func WithHTTPIdleTimeout(timeout time.Duration) HTTPOption
- func WithHTTPTimeout(timeout time.Duration) HTTPOption
- func WithHTTPTransport(transport http.RoundTripper) HTTPOption
- type Manager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPClient ¶
func NewHTTPClient(opts ...HTTPOption) *http.Client
NewHTTPClient creates a new HTTP client with the provided options. If no transport is specified, it defaults to otelhttp.NewTransport(http.DefaultTransport).
Types ¶
type HTTPOption ¶
type HTTPOption func(*httpConfig)
HTTPOption configures HTTP client behavior. It can be used to configure timeout, transport, and other HTTP client settings.
func WithHTTPCheckRedirect ¶
func WithHTTPCheckRedirect(checkRedirect func(req *http.Request, via []*http.Request) error) HTTPOption
WithHTTPCheckRedirect sets the redirect policy.
func WithHTTPCookieJar ¶
func WithHTTPCookieJar(jar http.CookieJar) HTTPOption
WithHTTPCookieJar sets the cookie jar.
func WithHTTPIdleTimeout ¶
func WithHTTPIdleTimeout(timeout time.Duration) HTTPOption
WithHTTPIdleTimeout sets the idle timeout.
func WithHTTPTimeout ¶
func WithHTTPTimeout(timeout time.Duration) HTTPOption
WithHTTPTimeout sets the request timeout.
func WithHTTPTransport ¶
func WithHTTPTransport(transport http.RoundTripper) HTTPOption
WithHTTPTransport sets the HTTP transport.
type Manager ¶ added in v1.63.0
type Manager interface {
Client(ctx context.Context) *http.Client
SetClient(ctx context.Context, cl *http.Client)
Invoke(ctx context.Context,
method string, endpointURL string, payload map[string]any,
headers map[string][]string, opts ...HTTPOption) (int, []byte, error)
InvokeWithURLEncoded(ctx context.Context,
method string, endpointURL string, payload url.Values,
headers map[string]string, opts ...HTTPOption) (int, []byte, error)
}
func NewManager ¶ added in v1.63.0
func NewManager(cfg config.ConfigurationTraceRequests, opts ...HTTPOption) Manager
NewManager creates a new invoker with the provided options.
Click to show internal directories.
Click to hide internal directories.