Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicHttpClient ¶
type BasicHttpClient struct {
HeaderProvider []HTTPHeaderProvider
}
func NewBasicHttpClient ¶
func NewBasicHttpClient() *BasicHttpClient
func (*BasicHttpClient) DoWithContext ¶
func (b *BasicHttpClient) DoWithContext(ctx context.Context, request *http.Request) (*http.Response, error)
DoWithContext implements HttpClient.
func (*BasicHttpClient) WithHeaderProvider ¶
func (b *BasicHttpClient) WithHeaderProvider(headerProvider ...HTTPHeaderProvider) *BasicHttpClient
WithHeaderProvider creates a new BasicHttpClient with given header provider additionally.
type HTTPClient ¶
type HTTPClient[T any] interface { // DoWithContext send request to DoWithContext(ctx context.Context, request *http.Request) (T, error) }
An interface to mock *http.Client
type HTTPHeaderProvider ¶
type HTTPHeaderProvider interface {
// AddHeader adds headers on outgoing request.
AddHeader(req *http.Request) error
}
HTTPHeaderProvider adds header on outgoing requests.
type JSONReponseHttpClient ¶
type JSONReponseHttpClient[T any] struct { // contains filtered or unexported fields }
func NewJsonResponseHttpClient ¶
func NewJsonResponseHttpClient[T any](client HTTPClient[*http.Response]) *JSONReponseHttpClient[T]
func (*JSONReponseHttpClient[T]) DoWithContext ¶
type RetryHttpClient ¶
type RetryHttpClient struct {
Client HTTPClient[*http.Response]
MinWaitSeconds int
MaxWaitSeconds int
MaxRetryCount int
RetriableHttpCodes []int
RetriableWithRefreshTokenHttpCodes []int
// contains filtered or unexported fields
}
func NewRetryHttpClient ¶
func NewRetryHttpClient(baseClient HTTPClient[*http.Response], minWaitSeconds int, maxWaitSeconds int, maxRetryCount int, retriableHttpCodes []int, retriableWithRefreshTokenHttpCodes []int, tokenRefresher token.TokenRefresher) *RetryHttpClient
func (*RetryHttpClient) DoWithContext ¶
func (r *RetryHttpClient) DoWithContext(ctx context.Context, originalRequest *http.Request) (*http.Response, error)
DoWithContext implements HttpClient.
Click to show internal directories.
Click to hide internal directories.