client

package
v1.65.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL