{"id":21925694,"url":"https://github.com/jmcfarlane/httprwd","last_synced_at":"2025-06-28T21:33:48.144Z","repository":{"id":57495984,"uuid":"72311794","full_name":"jmcfarlane/httprwd","owner":"jmcfarlane","description":"A golang http.ResponseWriter delegate that keeps track of the response code","archived":false,"fork":false,"pushed_at":"2023-05-07T01:11:21.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T11:44:21.044Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmcfarlane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-10-29T22:04:03.000Z","updated_at":"2016-10-29T22:42:14.000Z","dependencies_parsed_at":"2025-03-22T11:42:56.695Z","dependency_job_id":null,"html_url":"https://github.com/jmcfarlane/httprwd","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jmcfarlane/httprwd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcfarlane%2Fhttprwd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcfarlane%2Fhttprwd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcfarlane%2Fhttprwd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcfarlane%2Fhttprwd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmcfarlane","download_url":"https://codeload.github.com/jmcfarlane/httprwd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcfarlane%2Fhttprwd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262502751,"owners_count":23321173,"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-11-28T21:19:43.578Z","updated_at":"2025-06-28T21:33:48.117Z","avatar_url":"https://github.com/jmcfarlane.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# httprwd\n\nA simple [http.ResponseWriter](https://golang.org/pkg/net/http/#ResponseWriter)\ndelegate that keeps track of the response code.\n\n## Installation\n\n```\ngo get github.com/jmcfarlane/httprwd/...\n```\n\n## Usage\n\nThe typical use case is when you want to emit metrics about an http\nroute, and include the response code.\n\n```go\nd := \u0026httprwd.ResponseWriterDelegate{ResponseWriter: w}\nstart := time.Now()\nhandler.ServeHTTP(d, r)\nhandlerDuration.WithLabelValues(\n    r.URL.Path,\n    r.Method,\n    strconv.Itoa(d.Code),\n).Observe(time.Since(start).Seconds())\n```\n\n## Working example\n\n```\ngo run example/main.go\ncurl -s localhost:8080\ncurl -s localhost:8080/metrics\n```\n\n## Tests\n\n```\n$ go test -v -cover -race\n=== RUN   TestResponseWriterDelegateStatusOK\n--- PASS: TestResponseWriterDelegateStatusOK (0.00s)\n=== RUN   TestResponseWriterDelegateStatusNotFound\n--- PASS: TestResponseWriterDelegateStatusNotFound (0.00s)\n=== RUN   TestResponseWriterDelegateStatusUnset\n--- PASS: TestResponseWriterDelegateStatusUnset (0.00s)\nPASS\ncoverage: 100.0% of statements\nok  \tgithub.com/jmcfarlane/httprwd\t1.012s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmcfarlane%2Fhttprwd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmcfarlane%2Fhttprwd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmcfarlane%2Fhttprwd/lists"}