auresthttpclient

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instrument added in v0.4.0

func Instrument(
	client aurestclientapi.Client,
	requestMetricsCallback aurestclientapi.MetricsCallbackFunction,
	responseMetricsCallback aurestclientapi.MetricsCallbackFunction,
)

Instrument adds instrumentation to a http client.

Either of the callbacks may be nil.

func New

func New(timeout time.Duration, customCACert []byte, requestManipulator aurestclientapi.RequestManipulatorCallback) (aurestclientapi.Client, error)

New builds a new http client.

Do not share between different logging/circuit breaker/retry stacks, but you should only build each stack once.

timeout MUST be set to 0 if you use a circuit breaker or anything else that may do a context cancel, or you'll get weird behavior.

If len(customCACert) is 0, the default CA certificates are used, but if you specify it, they are excluded to ensure only your certs are accepted.

Types

type HttpClientImpl

type HttpClientImpl struct {
	HttpClient         *http.Client
	RequestManipulator aurestclientapi.RequestManipulatorCallback
	Timeout            time.Duration

	RequestMetricsCallback  aurestclientapi.MetricsCallbackFunction
	ResponseMetricsCallback aurestclientapi.MetricsCallbackFunction

	// Now is exposed so tests can fixate the time by overwriting this field
	Now func() time.Time
}

func (*HttpClientImpl) Perform

func (c *HttpClientImpl) Perform(ctx context.Context, method string, requestUrl string, requestBody interface{}, response *aurestclientapi.ParsedResponse) error

Jump to

Keyboard shortcuts

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