Documentation
¶
Overview ¶
Package httpclient provides a centralized HTTP client factory with preset configurations.
Index ¶
Constants ¶
View Source
const ( // DefaultTimeout is the standard timeout for most HTTP requests (30s). DefaultTimeout = 30 * time.Second // LongTimeout is for operations that may take longer (60s). LongTimeout = 60 * time.Second // FileUploadTimeout is for file upload operations (2 minutes). FileUploadTimeout = 2 * time.Minute )
Preset timeout durations for common use cases.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates a new HTTP client with the given options. If no timeout is specified, DefaultTimeout (30s) is used.
func NewDefault ¶
NewDefault creates a new HTTP client with the default timeout (30s).
func NewFileUpload ¶
NewFileUpload creates a new HTTP client for file upload operations (2 minutes).
Types ¶
type Option ¶
type Option func(*Options)
Option is a functional option for configuring HTTP clients.
func WithTransport ¶
WithTransport sets a custom transport.
Click to show internal directories.
Click to hide internal directories.