Skip to content

Commit

Permalink
doc: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
justinrixx committed Dec 18, 2023
1 parent e0f1402 commit 908329b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# retryhttp
# retryhttp [![Build Status](https://github.com/justinrixx/retryhttp/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/justinrixx/retryhttp/actions) [![Go Reference](https://pkg.go.dev/badge/github.com/justinrixx/retryhttp.svg)](https://pkg.go.dev/github.com/justinrixx/retryhttp)

`retryhttp` allows you to add HTTP retries to your service or application with no refactoring at all, just a few lines of configuration where your client is instantiated. This package's goals are:

- Make adding retries easy, with no refactor required (as stated above)
- [Provide a good starting point for retry behavior](./docs/default.md)
- [Make customizing retry behavior easy](./docs/options.md)
- [Allow for one-off behavior changes without needing multiple HTTP clients](./docs/options.md#example)
- 100% Go, with no external dependencies (have a peek at `go.mod`)
- 100% standard library, with no external dependencies (have a peek at `go.mod`)

## How it works

`retryhttp` exports a `Transport` struct which implements [the standard library's `http.RoundTripper` interface](https://pkg.go.dev/net/http#RoundTripper). By performing retries at the `http.RoundTripper` level, retries can be introduced to a service or script with just a few lines of configuration and no changes required to any of the code actually making HTTP requests. Regardless of which HTTP client you're using, it's very likely to have a configurable `http.RoundTripper`, which means this package can be integrated.

`http.RoundTripper`s are also highly composable. By default, this package uses `http.DefaultTransport` as its underlying `RoundTripper`, but you may choose to wrap a customized one that sets `MaxIdleConns`, or even [something like this](https://pkg.go.dev/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp#Transport) that captures metric spans to instrument your calls.

## Get it

```bash
$ go get github.com/justinrixx/retryhttp
```

## Example

```go
Expand Down

0 comments on commit 908329b

Please sign in to comment.