httpclient

package
v0.85.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const RetryCount = 3

Variables

This section is empty.

Functions

func NewThrottledTransport added in v0.43.0

func NewThrottledTransport(limitPeriod time.Duration, requestCount int, transportWrap http.RoundTripper) http.RoundTripper

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
	Get(url string) (*http.Response, error)
}

HTTPClient interface to define the contract of ALL http client to be used (http package or mocks)

func NewRetryClient added in v0.84.1

func NewRetryClient() HTTPClient

func NewThrottledClient added in v0.84.1

func NewThrottledClient(limitPeriod time.Duration, requestCount int, transportWrap http.RoundTripper) HTTPClient

type MockClient added in v0.19.0

type MockClient struct {
	DoFunc func(req *http.Request) (*http.Response, error)
}

MockClient is a stub implementation of an http.Client with a custom `Do` method

func (*MockClient) Do added in v0.19.0

func (m *MockClient) Do(req *http.Request) (*http.Response, error)

Do is the mock client's `Do` function that you can customize

func (*MockClient) Get added in v0.84.1

func (m *MockClient) Get(url string) (*http.Response, error)

type ThrottledTransport added in v0.43.0

type ThrottledTransport struct {
	// contains filtered or unexported fields
}

func (*ThrottledTransport) RoundTrip added in v0.43.0

func (c *ThrottledTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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