httpclient

package
v0.2.187 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RefreshFunc

type RefreshFunc func() (string, time.Time, error)

type RequestRunner

type RequestRunner interface {
	Do(*http.Request) (*http.Response, error)
}

RequestRunner is an abstraction for HTTP clients. The usual *http.Client type natively implements this interface; however, this interface also allows you to swap it client with your own implementation, if required.

func NewAuthenticatedClient

func NewAuthenticatedClient(inner RequestRunner, apiToken, apiTokenHeaderName string) RequestRunner

func NewAuthenticatedClientWithRefresh

func NewAuthenticatedClientWithRefresh(inner RequestRunner, apiToken, apiTokenHeaderName string, expiration time.Time, refreshFunc RefreshFunc) RequestRunner

func NewClientWithBaseURL

func NewClientWithBaseURL(inner RequestRunner, baseURL string) (RequestRunner, error)

func NewEventualConsistentClient

func NewEventualConsistentClient(inner RequestRunner) RequestRunner

NewEventualConsistentClient adds support for the eventual consistency behaviour as documented in 1 to a client.

func NewLoggingClient added in v0.2.1

func NewLoggingClient(inner RequestRunner, logger *slog.Logger, logRequestBodies, logResponseBodies bool) RequestRunner

Jump to

Keyboard shortcuts

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