HTTPClient is a zero dependency client which supports pluggable retry and pagination
go get -u github.com/pinpt/httpclient
The most basic usage which mimics http.Default:
httpclient.Default.Get("https://foo.com")
Customize the client by setting Config:
config := httpclient.NewConfig()
config.Retryable = httpclient.NewBackoffRetry(time.Millisecond, time.Millisecond*50, 10*time.Second, 2)
client := httpclient.NewHTTPClient(context.Background(), config, http.DefaultClient)
resp, err := client.Get("https://foo.com")
The httpclient package is very customizable. You can pass in any implementation of the Client interface which http.Client
implements. You can implement the Retryable and Paginator interfaces for customizing how to Retry failed requests and how to handle pagination.
Copyright © 2018-2019 by Pinpoint Software, Inc. MIT License. Pull requests welcome! 🙏🏻