Documentation
¶
Overview ¶
Package client provides a simple, generic HTTP client for sending various API requests to external services, which is used by other packages under pkg/api.
Index ¶
Constants ¶
View Source
const ( Timeout = 3 * time.Second MaxSize = 3 << 20 // 3 MiB. AcceptJSON = "application/json" AcceptText = "text/plain" ContentForm = "application/x-www-form-urlencoded" ContentJSON = "application/json; charset=utf-8" )
Variables ¶
This section is empty.
Functions ¶
func HTTPRequest ¶
func HTTPRequest(ctx context.Context, method, apiURL, auth, accept, contentType string, queryOrBody any) ([]byte, http.Header, int, error)
HTTPRequest sends an HTTP request to an external API service.
The queryOrBody parameter may be nil, url.Values, a []byte slice, or any struct that can be encoded as JSON.
Some errors (failure to construct a request or decode a response body) are returned as non-retryable temporal.ApplicationErrors.
On HTTP 429 (Too Many Requests) responses, the third return value contains the number of seconds to wait before retrying the request.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.