{"id":16788599,"url":"https://github.com/mna/httpmw","last_synced_at":"2026-01-12T07:57:56.617Z","repository":{"id":43145355,"uuid":"64036049","full_name":"mna/httpmw","owner":"mna","description":"Package httpmw is a collection of bite-sized middleware with chaining support.","archived":false,"fork":false,"pushed_at":"2016-08-05T01:47:52.000Z","size":47,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T10:28:27.517Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mna.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":"2016-07-23T21:03:39.000Z","updated_at":"2017-06-19T06:51:27.000Z","dependencies_parsed_at":"2022-08-28T08:11:56.897Z","dependency_job_id":null,"html_url":"https://github.com/mna/httpmw","commit_stats":null,"previous_names":["puerkitobio/httpmw"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fhttpmw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fhttpmw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fhttpmw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fhttpmw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mna","download_url":"https://codeload.github.com/mna/httpmw/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955715,"owners_count":20374372,"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-10-13T08:18:24.468Z","updated_at":"2026-01-03T17:03:36.153Z","avatar_url":"https://github.com/mna.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# httpmw [![GoDoc](https://godoc.org/github.com/PuerkitoBio/httpmw?status.png)][godoc] [![Build Status](https://semaphoreci.com/api/v1/mna/httpmw/branches/master/badge.svg)](https://semaphoreci.com/mna/httpmw)\n\nPackage httpmw is a collection of bite-sized middleware with chaining support. Uses the standard library's `http.Handler` interface. It's 🐢  🐢  🐢  all the way down. See the [godoc][] for full documentation.\n\n## Installation\n\n```\n$ go get github.com/PuerkitoBio/httpmw/...\n```\n\nUse `-u` to update, `-t` to install test dependencies.\n\n## Example\n\n```\nfunc myHandler(w http.ResponseWriter, r *http.Request) {\n    fmt.Fprint(w, \"hello, middleware...\")\n}\n\n// add a random request ID to all requests, with default configuration\nvar rid requestid.RequestID\n\n// extract the real client remote address, with default configuration\nvar ra remoteip.RemoteIP\n\n// limit the request body size to 1024 bytes\nbl := bodylimit.BodyLimit{N: 1024}\n\n// add CSRF support - this uses the github.com/gorilla/csrf external\n// package, but it is very easy to adapt any http.Handler-compliant\n// middleware out there. csrf.Protect returns a middleware-friendly\n// `func(http.Handler) http.Handler`, which can be adapted to an\n// httpmw.Wrapper using httpmw.WrapperFunc (much like http.Handler/\n// http.HandlerFunc).\nprotect := httpmw.WrapperFunc(csrf.Protect([]byte(/* the secret */)))\n\nh := httpmw.Wrap(http.HandlerFunc(myHandler), \u0026rid, \u0026ra, \u0026bl, protect)\n\n// serve using the middleware-augmented handler\nlog.Fatal(http.ListenAndServe(\":9000\", h))\n```\n\n## License\n\nThe [BSD 3-clause][bsd] license, see LICENSE file.\n\n[bsd]: http://opensource.org/licenses/BSD-3-Clause\n[godoc]: http://godoc.org/github.com/PuerkitoBio/httpmw\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmna%2Fhttpmw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmna%2Fhttpmw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmna%2Fhttpmw/lists"}