{"id":23340447,"url":"https://github.com/vthiery/avoca","last_synced_at":"2025-04-07T14:51:02.727Z","repository":{"id":38317010,"uuid":"290127777","full_name":"vthiery/avoca","owner":"vthiery","description":"Yet another HTTP client \\o/","archived":false,"fork":false,"pushed_at":"2023-08-15T02:07:35.000Z","size":51,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T17:30:25.497Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vthiery.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-25T06:02:31.000Z","updated_at":"2022-11-16T16:18:56.000Z","dependencies_parsed_at":"2024-06-21T02:10:41.575Z","dependency_job_id":"03725dbb-5e91-4ff6-9a61-b1090ef8ee2f","html_url":"https://github.com/vthiery/avoca","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vthiery%2Favoca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vthiery%2Favoca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vthiery%2Favoca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vthiery%2Favoca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vthiery","download_url":"https://codeload.github.com/vthiery/avoca/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675629,"owners_count":20977376,"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-12-21T04:31:54.561Z","updated_at":"2025-04-07T14:51:02.706Z","avatar_url":"https://github.com/vthiery.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Avoca\n\n[![PkgGoDev](https://pkg.go.dev/badge/vthiery/avoca)](https://pkg.go.dev/github.com/vthiery/avoca)\n[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/vthiery/avoca.svg)](https://github.com/vthiery/avoca)\n![Build Status](https://github.com/vthiery/avoca/workflows/Test/badge.svg)\n![GolangCI Lint](https://github.com/vthiery/avoca/workflows/GolangCI/badge.svg)\n![License](https://img.shields.io/github/license/vthiery/avoca)\n\n## Description\n\nYet another HTTP client \\o/\n\n## Installation\n\n```sh\ngo get -u github.com/vthiery/avoca\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/vthiery/avoca\"\n\t\"github.com/vthiery/retry\"\n)\n\nfunc main() {\n\tclient := avoca.NewClient(\n\t\tavoca.WithHTTPClient(\n\t\t\t\u0026http.Client{\n\t\t\t\t// Timeout the HTTP connection after 200 ms.\n\t\t\t\tTimeout: 200 * time.Millisecond,\n\t\t\t},\n\t\t),\n\t\t// Perform maximum 10 attempts with an exponential backoff.\n\t\tavoca.WithRetrier(\n\t\t\tretry.New(\n\t\t\t\tretry.WithMaxAttempts(10),\n\t\t\t\tretry.WithBackoff(\n\t\t\t\t\tretry.NewExponentialBackoff(\n\t\t\t\t\t\t100*time.Millisecond, // minWait\n\t\t\t\t\t\t1*time.Second,        // maxWait\n\t\t\t\t\t\t2*time.Millisecond,   // maxJitter\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t\t// Only retry when the status code is \u003e= 500\n\t\tavoca.WithRetryPolicy(\n\t\t\tfunc(statusCode int) bool {\n\t\t\t\treturn statusCode \u003e= http.StatusInternalServerError\n\t\t\t},\n\t\t),\n\t)\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tres, err := client.Get(ctx, \"http://google.com\", nil)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to GET: %v\\n\", err)\n\t}\n\tdefer res.Body.Close()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvthiery%2Favoca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvthiery%2Favoca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvthiery%2Favoca/lists"}