httpclient

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

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.

func (*HeaderRoundTripper) RoundTrip

func (hrt *HeaderRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip adds default headers when they're not present on the request and delegates to the next RoundTripper.

Jump to

Keyboard shortcuts

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