{"id":13413649,"url":"https://github.com/hashicorp/go-retryablehttp","last_synced_at":"2025-05-13T15:04:15.506Z","repository":{"id":40910307,"uuid":"47565506","full_name":"hashicorp/go-retryablehttp","owner":"hashicorp","description":"Retryable HTTP client in Go","archived":false,"fork":false,"pushed_at":"2025-04-16T10:15:07.000Z","size":216,"stargazers_count":2124,"open_issues_count":73,"forks_count":264,"subscribers_count":294,"default_branch":"main","last_synced_at":"2025-05-05T22:41:39.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hashicorp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-12-07T16:46:24.000Z","updated_at":"2025-05-05T14:34:43.000Z","dependencies_parsed_at":"2025-03-17T21:27:58.037Z","dependency_job_id":"c3c68155-5f76-4ac3-8f1e-5f070aa6e563","html_url":"https://github.com/hashicorp/go-retryablehttp","commit_stats":{"total_commits":162,"total_committers":53,"mean_commits":3.056603773584906,"dds":0.8765432098765432,"last_synced_commit":"40b0cad1633fd521cee5884724fcf03d039aaf3f"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fgo-retryablehttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fgo-retryablehttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fgo-retryablehttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashicorp%2Fgo-retryablehttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hashicorp","download_url":"https://codeload.github.com/hashicorp/go-retryablehttp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253968688,"owners_count":21992257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:45.402Z","updated_at":"2025-05-13T15:04:15.480Z","avatar_url":"https://github.com/hashicorp.png","language":"Go","readme":"go-retryablehttp\n================\n\n[![Build Status](http://img.shields.io/travis/hashicorp/go-retryablehttp.svg?style=flat-square)][travis]\n[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs]\n\n[travis]: http://travis-ci.org/hashicorp/go-retryablehttp\n[godocs]: http://godoc.org/github.com/hashicorp/go-retryablehttp\n\nThe `retryablehttp` package provides a familiar HTTP client interface with\nautomatic retries and exponential backoff. It is a thin wrapper over the\nstandard `net/http` client library and exposes nearly the same public API. This\nmakes `retryablehttp` very easy to drop into existing programs.\n\n`retryablehttp` performs automatic retries under certain conditions. Mainly, if\nan error is returned by the client (connection errors, etc.), or if a 500-range\nresponse code is received (except 501), then a retry is invoked after a wait\nperiod.  Otherwise, the response is returned and left to the caller to\ninterpret.\n\nThe main difference from `net/http` is that requests which take a request body\n(POST/PUT et. al) can have the body provided in a number of ways (some more or\nless efficient) that allow \"rewinding\" the request body if the initial request\nfails so that the full request can be attempted again. See the\n[godoc](http://godoc.org/github.com/hashicorp/go-retryablehttp) for more\ndetails.\n\nVersion 0.6.0 and before are compatible with Go prior to 1.12. From 0.6.1 onward, Go 1.12+ is required.\nFrom 0.6.7 onward, Go 1.13+ is required.\n\nExample Use\n===========\n\nUsing this library should look almost identical to what you would do with\n`net/http`. The most simple example of a GET request is shown below:\n\n```go\nresp, err := retryablehttp.Get(\"/foo\")\nif err != nil {\n    panic(err)\n}\n```\n\nThe returned response object is an `*http.Response`, the same thing you would\nusually get from `net/http`. Had the request failed one or more times, the above\ncall would block and retry with exponential backoff.\n\n## Getting a stdlib `*http.Client` with retries\n\nIt's possible to convert a `*retryablehttp.Client` directly to a `*http.Client`.\nThis makes use of retryablehttp broadly applicable with minimal effort. Simply\nconfigure a `*retryablehttp.Client` as you wish, and then call `StandardClient()`:\n\n```go\nretryClient := retryablehttp.NewClient()\nretryClient.RetryMax = 10\n\nstandardClient := retryClient.StandardClient() // *http.Client\n```\n\nFor more usage and examples see the\n[pkg.go.dev](https://pkg.go.dev/github.com/hashicorp/go-retryablehttp).\n","funding_links":[],"categories":["Go","Networking","Middlewares \u0026 framework add-ons","网络","HTTP Clients"],"sub_categories":["HTTP Clients","HTTP客户端"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashicorp%2Fgo-retryablehttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhashicorp%2Fgo-retryablehttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashicorp%2Fgo-retryablehttp/lists"}