http

package
v0.0.0-...-ee67b27 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is used to make HTTP requests. It adds additional functionality like automatic retries to tolerate minor outages and rate limiting

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new Client with specified options. NoOp logger, retryablehttp.NewClient(), infinite rate limiter by default

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do wraps calling an HTTP method with retries and rate limiting

type Option

type Option func(c *Client)

Option func type

func WithLogger

func WithLogger(logger log.L) Option

WithLogger sets logger limiter, Infinite by default

func WithRateLimiter

func WithRateLimiter(limiter *rate.Limiter) Option

WithRateLimiter sets rate limiter, Infinite by default

func WithRetryableHTTP

func WithRetryableHTTP(client *retryablehttp.Client) Option

WithRetryableHTTP sets retryablehttp client, retryablehttp.New() by default

Jump to

Keyboard shortcuts

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