Versions in this module Expand all Collapse all v1 v1.0.0 Jul 19, 2025 Changes in this version + func BrotliDecompress(body io.ReadCloser) ([]byte, error) + func DecompressResponse(headers map[string][]string, body io.ReadCloser) ([]byte, error) + func DeflateDecompress(body io.ReadCloser) ([]byte, error) + func DoWithRetry[T Doer[Rq, Rp], Rq Request, Rp Response](ctx context.Context, client T, req Rq, numRetries int, logger Logger) (Rp, error) + func GzipDecompress(body io.ReadCloser) ([]byte, error) + func IsClientError(err error) bool + func IsIn100s(statusCode int) bool + func IsIn200s(statusCode int) bool + func IsIn300s(statusCode int) bool + func IsIn400s(statusCode int) bool + func IsIn500s(statusCode int) bool + func IsProxyError(err error) bool + func ParseError(err error) error + func ZstdDecompress(body io.ReadCloser) ([]byte, error) + type ClientErr struct + TimedOut bool + func (c ClientErr) Error() string + type ClientOption func(c *RetryableHTTPClient[T, Rq, Rp]) + func WithLogger[T Doer[Rq, Rp], Rq Request, Rp Response](logger Logger) ClientOption[T, Rq, Rp] + func WithRetries[T Doer[Rq, Rp], Rq Request, Rp Response](numRetries int) ClientOption[T, Rq, Rp] + type Doer interface + Do func(Rq) (Rp, error) + type Logger interface + Debug func(format string, args ...any) + Error func(format string, args ...any) + Info func(format string, args ...any) + Warn func(format string, args ...any) + func NewDebugLogger(logger Logger) Logger + func NewLogger() Logger + func NewSilentLogger() Logger + type NetworkError string + const BadURL + const ConnectionRefused + const ConnectionTimedOut + const DNSNameNotFound + const EOF + const GenericError + const HostUnreachable + const NetworkUnreachable + const ProxyAuthRequired + const ProxyRelayOffline + func ClassifyNetworkError(err error) NetworkError + type ProxyErr struct + InvalidAuth bool + InvalidHost bool + InvalidPort bool + func (p ProxyErr) Error() string + type Request interface + type RequestErr struct + Message string + func (r RequestErr) Error() string + type Response interface + type ResponseWithHeader interface + Header func() map[string][]string + type RetryableHTTPClient struct + func NewRetryableHTTPClient[T Doer[Rq, Rp], Rq Request, Rp Response](client T, opts ...ClientOption[T, Rq, Rp]) *RetryableHTTPClient[T, Rq, Rp] + func (c *RetryableHTTPClient[T, Rq, Rp]) Do(ctx context.Context, req Rq) (Rp, error) + func (c *RetryableHTTPClient[T, Rq, Rp]) DoWithRetry(ctx context.Context, req Rq) (Rp, error)