client

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResponseCookies added in v0.2.5

func GetResponseCookies(resp *http.Response) []*http.Cookie

GetResponseCookies extracts cookies from an HTTP response

Types

type Certificate

type Certificate struct {
	Cert       string
	Key        string
	PFX        string
	Passphrase string
}

Certificate holds TLS certificate configuration

type ClientConfig

type ClientConfig struct {
	Timeout         time.Duration
	FollowRedirects bool
	InsecureSSL     bool
	Proxy           string
	ExcludeProxy    []string
	RememberCookies bool
	DefaultHeaders  map[string]string
	Certificates    map[string]Certificate
}

ClientConfig holds client configuration

func DefaultConfig

func DefaultConfig() *ClientConfig

DefaultConfig returns a default client configuration

type HttpClient

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

HttpClient is an HTTP client with auth support

func NewHttpClient

func NewHttpClient(config *ClientConfig) (*HttpClient, error)

NewHttpClient creates a new HTTP client

func (*HttpClient) ClearCookies

func (c *HttpClient) ClearCookies()

ClearCookies clears all stored cookies

func (*HttpClient) GetCookies added in v0.2.5

func (c *HttpClient) GetCookies(urlStr string) []*http.Cookie

GetCookies returns all cookies for a given URL

func (*HttpClient) Send

func (c *HttpClient) Send(request *models.HttpRequest) (*models.HttpResponse, error)

Send sends an HTTP request and returns the response

func (*HttpClient) SendWithContext

func (c *HttpClient) SendWithContext(ctx context.Context, request *models.HttpRequest) (*models.HttpResponse, error)

SendWithContext sends an HTTP request with context

func (*HttpClient) SetCookies added in v0.2.5

func (c *HttpClient) SetCookies(urlStr string, cookies []*http.Cookie)

SetCookies sets cookies for a given URL

Jump to

Keyboard shortcuts

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