Documentation ¶
Index ¶
- type HttpClient
- type WrappedHttpClient
- func (c *WrappedHttpClient) Do(req *http.Request) (resp *http.Response, err error)
- func (c *WrappedHttpClient) Get(url string) (*http.Response, error)
- func (c *WrappedHttpClient) Head(url string) (*http.Response, error)
- func (c *WrappedHttpClient) Post(url, contentType string, body io.Reader) (*http.Response, error)
- func (c *WrappedHttpClient) PostForm(url string, data url.Values) (*http.Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpClient ¶
HttpClient is a simplified version of http.Client interface
type WrappedHttpClient ¶
type WrappedHttpClient struct {
// contains filtered or unexported fields
}
WrappedHttpClient is a wrapper around HttpClient which retries requests in case of errors. It implements all of public methods available in http.Client
func NewHttpClient ¶
func NewHttpClient(opts ...retry.Option) *WrappedHttpClient
NewHttpClient returns new WrappedHttpClient with default http.Client as upstream. If you want to configure it in anyway use WrapHttpClient instead.
func WrapHttpClient ¶
func WrapHttpClient(client HttpClient, opts ...retry.Option) *WrappedHttpClient
WrapHttpClient returns new WrappedHttpClient with given HttpClient as upstream
func (*WrappedHttpClient) Do ¶
Do calls Do method of underlying HttpClient and retries according to given options when an error occurs
func (*WrappedHttpClient) Get ¶
func (c *WrappedHttpClient) Get(url string) (*http.Response, error)
Get is copied from http.Client to be compliant with its interface. For more documentation see http.Client.Get
func (*WrappedHttpClient) Head ¶
func (c *WrappedHttpClient) Head(url string) (*http.Response, error)
Head is copied from http.Client to be compliant with its interface. For more documentation see http.Client.Head