Documentation
¶
Overview ¶
Package httpc is a small bearer-token JSON client with typed errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrForbidden = errors.New("forbidden") ErrNotFound = errors.New("not found") ErrConflict = errors.New("conflict") )
Sentinel errors for the HTTP statuses a command may handle. Do returns errors that wrap them, so callers use errors.Is.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Status int
// Body is the FastAPI `detail` when present, else the raw body.
Body string
}
APIError is any other non-2xx response.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client sends JSON requests with a bearer token.
type Option ¶
type Option func(*Client)
Option configures New.
func WithHTTPClient ¶
WithHTTPClient replaces the default 30-second-timeout client.
func WithUserAgent ¶
WithUserAgent sets `User-Agent: lfed-plugin/<name>`.