{"id":25237994,"url":"https://github.com/vspaz/goat","last_synced_at":"2025-04-05T18:43:01.898Z","repository":{"id":64993982,"uuid":"420513717","full_name":"vspaz/goat","owner":"vspaz","description":"Go HTTP client that makes it plain simple to configure TLS, basic auth, retries on specific errors, keep-alive connections, logging, timeouts, etc.","archived":false,"fork":false,"pushed_at":"2025-03-08T16:25:50.000Z","size":3409,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T17:22:44.767Z","etag":null,"topics":["basic-authentication","go","golang","http","http-client","requests","retry","timeouts","tls","tls-certificate","tls-support"],"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/vspaz.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":"2021-10-23T20:15:11.000Z","updated_at":"2025-03-08T16:15:48.000Z","dependencies_parsed_at":"2025-03-08T17:31:41.836Z","dependency_job_id":null,"html_url":"https://github.com/vspaz/goat","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vspaz%2Fgoat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vspaz%2Fgoat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vspaz%2Fgoat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vspaz%2Fgoat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vspaz","download_url":"https://codeload.github.com/vspaz/goat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247385551,"owners_count":20930597,"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":["basic-authentication","go","golang","http","http-client","requests","retry","timeouts","tls","tls-certificate","tls-support"],"created_at":"2025-02-11T16:03:04.539Z","updated_at":"2025-04-05T18:43:01.863Z","avatar_url":"https://github.com/vspaz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goat\n\nGoat, is an HTTP client built on top of a standard Go http package, that is extremely easy to configure; no googling\nrequired. The idea is similar to https://github.com/vspaz/pyclient\nit supports out of the box:\n\n* TLS,\n* basic auth\n* delayed retries on specific errors\n* timeouts (connection, read, idle etc.)\n* keep-alive connections\n* extra helpers\n* logging\n* etc.\n\nstill, if you don't wish any configuration, you can you use it as is with default parameters. Please, see the examples\nbelow:\n\n### Local installation\n\n```shell\ngo get -u github.com/vspaz/goat/pkg/ghttp@v1.2.1\n```\n\n### Building a client\n\n```go\npackage main\n\nimport (\n\t\"github.com/vspaz/goat/pkg/ghttp\"\n\t\"log\"\n)\n\nfunc main() {\n\tclient := ghttp.NewClientBuilder().\n\t\tWithHost(\"https://httpbin.org\"). // optional \n\t\tWithAuth(\"user\", \"user-password\"). // optional \n\t\tWithTls(\"cert.pem\", \"cert.pem\", \"ca.crt\"). // optional \n\t\tWithTlsHandshakeTimeout(10.0). // optional\n\t\tWithUserAgent(\"goat\"). // optional\n\t\tWithRetry(3, []int{500, 503}). // optional \n\t\tWithDelay(0.5). // optional\n\t\tWithResponseTimeout(10.0). // optional\n\t\tWithConnectionTimeout(2.0). // optional \n\t\tWithHeadersReadTimeout(2.0). // optional\n\t\tWithLogLevel(\"info\"). // optional \n\t\tBuild()\n\n\tresp, err := client.DoGet(\"/get\", nil, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Println(resp.IsOk())\n\n\t// or just\n\tclient = ghttp.NewClientBuilder().Build()\n\tresp, err = client.DoGet(\"https://httpbin.org/get\", nil, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Println(resp.IsOk())\n}\n```\n\n### /GET\n\n```go\npackage main\n\nimport (\n\t\"github.com/vspaz/goat/pkg/ghttp\"\n\t\"log\"\n)\n\ntype HttpBinGetResponse struct {\n\tArgs struct {\n\t} `json:\"args\"`\n\tHeaders struct {\n\t\tAcceptEncoding string `json:\"Accept-Encoding\"`\n\t\tAuthorization  string `json:\"Authorization\"`\n\t\tHost           string `json:\"Host\"`\n\t\tUserAgent      string `json:\"User-Agent\"`\n\t\tXAmznTraceId   string `json:\"X-Amzn-Trace-Id\"`\n\t} `json:\"headers\"`\n\tOrigin string `json:\"origin\"`\n\tUrl    string `json:\"url\"`\n}\n\nfunc main() {\n\tclient := ghttp.NewClientBuilder().Build()\n\tresp, err := client.DoGet(\"https://httpbin.org/get\", nil, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Println(resp.IsOk())\n\tlog.Println(resp.ToString())\n}\n```\n\n### /POST\n\n```go\n\npackage main\n\nimport (\n\t\"github.com/vspaz/goat/pkg/ghttp\"\n\t\"log\"\n)\n\nfunc main() {\n\tclient := ghttp.NewClientBuilder().Build()\n\tresp, err := client.DoPost(\n\t\t\"https://httpbin.org/post\",\n\t\tmap[string]string{\"Content-Type\": \"application/json\"},\n\t\tmap[string]string{\"param\": \"value\"},\n\t\tmap[string]string{\"foo\": \"bar\"})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Println(resp.IsOk())\n\tlog.Println(resp.ToString())\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvspaz%2Fgoat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvspaz%2Fgoat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvspaz%2Fgoat/lists"}