client

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package client provides a simple, generic HTTP client for sending GET and POST requests to external services, which is used by other packages under pkg/api.

Index

Constants

View Source
const (
	Timeout = 3 * time.Second
	MaxSize = 4 << 20 // 4 MiB.

	AcceptJSON = "application/json"
)

Variables

This section is empty.

Functions

func HTTPRequest

func HTTPRequest(ctx context.Context, httpMethod, u, authToken, accept string, queryOrJSONBody any) ([]byte, error)

HTTPRequest sends an HTTP GET or POST request to an external API service.

For GET requests, the queryOrJSONBody parameter is expected to be url.Values. For other request methods (e.g. POST), it should be 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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL