Documentation
¶
Overview ¶
Package httpclient provides a thin HTTP client for the Frisco API. It handles auth headers, query params, body serialisation, automatic token refresh on 401, and sensitive-data sanitisation in error messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentRateLimit ¶
CurrentRateLimit returns the active limiter settings.
func RequestJSON ¶
RequestJSON performs an HTTP request and returns the parsed JSON response.
func SetRateLimit ¶
SetRateLimit configures the shared process-wide request limiter. rps <= 0 disables throttling.
Types ¶
type DataFormat ¶
type DataFormat string
DataFormat specifies how the request body should be encoded.
const ( FormatJSON DataFormat = "json" // encode body as JSON FormatForm DataFormat = "form" // encode body as application/x-www-form-urlencoded FormatRaw DataFormat = "raw" // send body string as-is )
DataFormat constants define supported body encoding formats.
type ErrorDetails ¶
type ErrorDetails struct {
Status int `json:"status"`
Reason string `json:"reason"`
URL string `json:"url,omitempty"`
Body string `json:"body,omitempty"`
}
func ParseError ¶
func ParseError(err error) (*ErrorDetails, bool)
func (*ErrorDetails) Error ¶
func (e *ErrorDetails) Error() string
type RequestOpts ¶
type RequestOpts struct {
Query []string
Data any
DataFormat DataFormat
ExtraHeaders map[string]string
Client *http.Client
}
RequestOpts bundles optional arguments for RequestJSON.
Click to show internal directories.
Click to hide internal directories.