Documentation
¶
Overview ¶
Package httpx centralizes HTTP client behavior such as retries and rate limiting.
Index ¶
- type Client
- func (c *Client) Do(req *http.Request, v any) error
- func (c *Client) NewMultipartRequest(ctx context.Context, method, path string, files []MultipartFile) (*http.Request, error)
- func (c *Client) NewRequest(ctx context.Context, method, path string, body any) (*http.Request, error)
- func (c *Client) RateLimitState() RateLimit
- type MultipartFile
- type Options
- type RateLimit
- type RetryPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps HTTP access with Bitbucket-aware defaults.
func (*Client) NewMultipartRequest ¶
func (c *Client) NewMultipartRequest(ctx context.Context, method, path string, files []MultipartFile) (*http.Request, error)
NewMultipartRequest builds a multipart/form-data request for file uploads. The request body is buffered in memory to support retries.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(ctx context.Context, method, path string, body any) (*http.Request, error)
NewRequest builds an HTTP request relative to the base URL. Body values are JSON encoded when non-nil.
func (*Client) RateLimitState ¶
RateLimitState returns the last observed rate limit headers.
type MultipartFile ¶
type MultipartFile struct {
FieldName string // Form field name (e.g., "files")
FileName string // Original filename
Reader io.Reader // File content
}
MultipartFile represents a file for multipart/form-data upload.
type Options ¶
type Options struct {
BaseURL string
Username string
Password string
UserAgent string
Timeout time.Duration
EnableCache bool
Retry RetryPolicy
Debug bool
}
Options configures a Client.
Click to show internal directories.
Click to hide internal directories.