{"id":26820450,"url":"https://github.com/nmrshll/go-httpclient-middl","last_synced_at":"2025-03-30T06:32:28.468Z","repository":{"id":57610325,"uuid":"149870625","full_name":"nmrshll/go-httpclient-middl","owner":"nmrshll","description":"Add middleware to your HTTP clients in Go","archived":false,"fork":false,"pushed_at":"2018-09-22T12:55:14.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T12:52:49.631Z","etag":null,"topics":["client","go","golang","http","http-client","middleware"],"latest_commit_sha":null,"homepage":null,"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/nmrshll.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}},"created_at":"2018-09-22T11:26:49.000Z","updated_at":"2022-03-03T15:11:59.000Z","dependencies_parsed_at":"2022-09-26T20:02:11.416Z","dependency_job_id":null,"html_url":"https://github.com/nmrshll/go-httpclient-middl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmrshll%2Fgo-httpclient-middl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmrshll%2Fgo-httpclient-middl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmrshll%2Fgo-httpclient-middl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmrshll%2Fgo-httpclient-middl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nmrshll","download_url":"https://codeload.github.com/nmrshll/go-httpclient-middl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285619,"owners_count":20752951,"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":["client","go","golang","http","http-client","middleware"],"created_at":"2025-03-30T06:32:24.744Z","updated_at":"2025-03-30T06:32:28.461Z","avatar_url":"https://github.com/nmrshll.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/nmrshll/go-httpclient-middl.svg?branch=master)](https://travis-ci.com/nmrshll/go-httpclient-middl)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nmrshll/go-httpclient-middl)](https://goreportcard.com/report/github.com/nmrshll/go-httpclient-middl)\n\n# go-httpclient-middl\nAdd middleware to your HTTP clients in Go\n\n## Why ?\nIf you need an HTTP client that automatically logs requests, tracks metrics, joins a token with each request, validates HTTP status codes, or does any other custom action for every request/reponse, this library might be for you.\n\n## How ?\nDownload the library using `go get -u github.com/nmrshll/go-httpclient-middl`\n\nThen use it this way:  \n\n[embedmd]:# (.docs/examples/quickstart.go /func main/ $)\n```go\nfunc main() {\n\thttpClient := http.Client{Timeout: 30 * time.Second}\n\tclient, err := middl.NewClient(\u0026httpClient)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// add middleware to you client (classic examples provided in this library or custom)\n\tclient.UseMiddleware(logger.New())\n\tclient.UseMiddleware(statusvalidator.New())\n\n\t// then do your requests as usual\n\tresp, err := client.Get(\"https://google.com\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif resp == nil {\n\t\tlog.Fatalf(\"no response from server\")\n\t} // else\n\tdefer resp.Body.Close()\n\n\t// do something with the response here\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmrshll%2Fgo-httpclient-middl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmrshll%2Fgo-httpclient-middl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmrshll%2Fgo-httpclient-middl/lists"}