Skip to content

A zero-dependency pluggable go http client which supports Retry and Pagination interfaces

License

Notifications You must be signed in to change notification settings

pinpt/httpclient

Repository files navigation

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! 🙏🏻

About

A zero-dependency pluggable go http client which supports Retry and Pagination interfaces

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •