retryhttp

package
v0.0.0-...-7426b64 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTimeout = time.Second * 30
	DefaultRetries = 5
	DefaultClient  = NewClient(DefaultTimeout, DefaultRetries)
)

Functions

This section is empty.

Types

type Client

type Client struct {
	*retryablehttp.Client
}

func NewClient

func NewClient(timeout time.Duration, retries int) *Client

func (*Client) Do

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

func (*Client) Get

func (c *Client) Get(url string) (*http.Response, error)

func (*Client) Head

func (c *Client) Head(url string) (*http.Response, error)

func (*Client) Post

func (c *Client) Post(url, bodyType string, body interface{}) (*http.Response, error)

func (*Client) PostForm

func (c *Client) PostForm(url string, data url.Values) (*http.Response, error)

func (*Client) StandardClient

func (c *Client) StandardClient() *http.Client

type Logger

type Logger interface {
	Printf(string, ...interface{})
}

type RoundTripper

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

RoundTripper implements the http.RoundTripper interface, using a retrying HTTP client to execute requests.

func (*RoundTripper) RoundTrip

func (rt *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip satisfies the http.RoundTripper interface.

type UserNetworkError

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

func (*UserNetworkError) Error

func (e *UserNetworkError) Error() string

func (*UserNetworkError) ExitCode

func (e *UserNetworkError) ExitCode() int

Jump to

Keyboard shortcuts

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