httpclient

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHTTPClientTimeout = 60 * time.Second
)

Variables

This section is empty.

Functions

func NewHTTPClient added in v0.8.0

func NewHTTPClient(timeout time.Duration) *http.Client

func NewHTTPClientWithConfig added in v0.8.0

func NewHTTPClientWithConfig(cfg ClientConfig) *http.Client

Types

type ClientConfig added in v0.8.0

type ClientConfig struct {
	Timeout          time.Duration
	Jar              http.CookieJar
	TransportOptions TransportOptions
}

type LoggingHTTPClient

type LoggingHTTPClient struct {
	// contains filtered or unexported fields
}

LoggingHTTPClient wraps an HTTP client to add centralized request/response logging.

func NewLoggingHTTPClient

func NewLoggingHTTPClient(logger *slog.Logger) *LoggingHTTPClient

NewLoggingHTTPClient creates a new logging HTTP client

func NewLoggingHTTPClientWithClient

func NewLoggingHTTPClientWithClient(client *http.Client, logger *slog.Logger) *LoggingHTTPClient

NewLoggingHTTPClientWithClient wraps an existing HTTP client

func (*LoggingHTTPClient) Do

func (c *LoggingHTTPClient) Do(req *http.Request) (*http.Response, error)

Do implements the HTTPClient interface with logging

type TransportOptions added in v0.8.0

type TransportOptions struct {
	TCPUserTimeout            time.Duration
	DisableKeepAlives         bool
	RecycleConnectionsOnError bool
}

Jump to

Keyboard shortcuts

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