Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.09 KB

README.md

File metadata and controls

36 lines (24 loc) · 1.09 KB
pinpt-logo

HTTPClient is a zero dependency client which supports pluggable retry and pagination

Setup

go get -u github.com/pinpt/httpclient

Usage

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")

Pluggable

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.

License

Copyright © 2018-2019 by Pinpoint Software, Inc. MIT License. Pull requests welcome! 🙏🏻