pkg

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: Apache-2.0 Imports: 8 Imported by: 335

Documentation

Index

Constants

View Source
const (
	HTTP_2xx = 2
	HTTP_4xx = 4
)

Variables

This section is empty.

Functions

func ExpBackoff added in v0.8.0

func ExpBackoff(interval, max time.Duration) time.Duration

Types

type Err added in v0.8.0

type Err error

type ErrInvalid added in v0.8.0

type ErrInvalid struct {
	Err
}

type ErrNetwork added in v0.8.0

type ErrNetwork struct {
	Err
}

type ErrNotFound added in v0.8.0

type ErrNotFound struct {
	Err
}

type ErrServer added in v0.8.0

type ErrServer struct {
	Err
}

type ErrTimeout added in v0.8.0

type ErrTimeout struct {
	Err
}

type Getter added in v0.9.2

type Getter interface {
	Get(string) ([]byte, error)
	GetRetry(string) ([]byte, error)
}

type HttpClient

type HttpClient struct {
	// Initial backoff duration. Defaults to 50 milliseconds
	InitialBackoff time.Duration

	// Maximum exp backoff duration. Defaults to 5 seconds
	MaxBackoff time.Duration

	// Maximum number of connection retries. Defaults to 15
	MaxRetries int

	// Headers to add to the request.
	Header http.Header
	// contains filtered or unexported fields
}

func NewHttpClient

func NewHttpClient() *HttpClient

func NewHttpClientHeader added in v1.11.0

func NewHttpClientHeader(header http.Header) *HttpClient

func (*HttpClient) Get

func (h *HttpClient) Get(dataURL string) ([]byte, error)

func (*HttpClient) GetRetry added in v0.8.0

func (h *HttpClient) GetRetry(rawurl string) ([]byte, error)

GetRetry fetches a given URL with support for exponential backoff and maximum retries

Jump to

Keyboard shortcuts

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