Documentation
¶
Overview ¶
Package httpclient provides a centralized HTTP client configuration for pipeleek. It offers a retryable HTTP client with cookie support, custom headers, and proxy configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPipeleekHTTPClient ¶
func GetPipeleekHTTPClient(cookieUrl string, cookies []*http.Cookie, defaultHeaders map[string]string) *retryablehttp.Client
GetPipeleekHTTPClient creates and configures a retryable HTTP client for pipeleek operations. It supports:
- Cookie jar configuration for session management
- Custom default headers
- Automatic retry logic for 429 and 5xx errors (except 501)
- HTTP proxy support via HTTP_PROXY environment variable (unless SetIgnoreProxy(true) is called)
- TLS certificate verification bypass (InsecureSkipVerify)
Parameters:
- cookieUrl: The URL to associate cookies with (required if cookies are provided)
- cookies: Optional cookies to add to the jar
- defaultHeaders: Optional headers to add to all requests
Returns a configured *retryablehttp.Client ready for use.
func SetIgnoreProxy ¶ added in v0.48.0
func SetIgnoreProxy(ignore bool)
SetIgnoreProxy sets whether to ignore the HTTP_PROXY environment variable. This is useful in environments where HTTP_PROXY is set but should not be used.
Types ¶
type HeaderRoundTripper ¶
type HeaderRoundTripper struct {
Headers map[string]string
Next http.RoundTripper
}
HeaderRoundTripper is an http.RoundTripper that adds default headers to requests. Headers are only added if they're not already present in the request.