httpclient

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(cfg *Config) *http.Client

NewClient creates a new highly optimized HTTP client

Types

type Config

type Config struct {
	Timeout         time.Duration
	FollowRedirects bool
	UserAgent       string
}

Config holds HTTP client configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default HTTP client configuration

type Result

type Result struct {
	URL         string
	StatusCode  int
	Size        int64
	BodyHash    string
	ContentType string
	RedirectURL string
	Error       error
}

Result holds the HTTP request result

func HeadRequest

func HeadRequest(client *http.Client, url string, userAgent string) *Result

HeadRequest performs an HTTP HEAD request (much faster, no body transfer)

func Request

func Request(client *http.Client, url string, userAgent string) *Result

Request performs an HTTP GET request and returns the result (headers only)

func RequestWithBody

func RequestWithBody(client *http.Client, url string, userAgent string) *Result

RequestWithBody performs an HTTP GET request and reads the body for hashing

Jump to

Keyboard shortcuts

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