client

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseHeaders

func ParseHeaders(raw []string) map[string]string

ParseHeaders splits raw "Key: Value" strings into a map. Values containing colons are handled correctly (split on first ": " only).

Types

type Client

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

func NewClient

func NewClient(config Config) *Client

func (*Client) ExecuteRequest

func (c *Client) ExecuteRequest(ctx context.Context, params RequestParams) (*Response, error)

type Config

type Config struct {
	BaseURL         string
	DefaultHeaders  map[string]string
	Timeout         time.Duration
	MaxResponseSize int64
	ProxyURL        string
	RetryCount      int
	RetryDelay      time.Duration
	InsecureTLS     bool
	EnableCookieJar bool
}

type RequestParams

type RequestParams struct {
	Method          string
	URL             string
	Headers         map[string]string
	Body            string
	QueryParams     map[string]string
	Timeout         time.Duration
	FollowRedirects bool
	SaveTo          string            // write response body to this file instead of returning it
	MaxResponseSize int64             // per-request override; 0 means use the client default
	Files           map[string]string // multipart uploads: form field name -> local file path
	FormFields      map[string]string // multipart text fields, sent alongside Files
}

type Response

type Response struct {
	StatusCode   int
	StatusText   string
	Headers      http.Header
	ContentType  string
	Body         []byte
	Duration     time.Duration
	Truncated    bool
	OriginalSize int64
	SavedPath    string
	SavedSize    int64
}

Jump to

Keyboard shortcuts

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