{"id":21254183,"url":"https://github.com/rluders/httpsuite","last_synced_at":"2025-10-17T06:45:02.400Z","repository":{"id":261973817,"uuid":"885814005","full_name":"rluders/httpsuite","owner":"rluders","description":" A Go library to simplify request parsing, validation, and response handling in microservices, making code cleaner and more maintainable.","archived":false,"fork":false,"pushed_at":"2025-07-08T11:53:47.000Z","size":42,"stargazers_count":36,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-29T12:34:03.454Z","etag":null,"topics":["golang","golang-package","requests","response","rest","validation"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/rluders/httpsuite/v2","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/rluders.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":"rluders"}},"created_at":"2024-11-09T13:19:09.000Z","updated_at":"2025-07-12T21:21:39.000Z","dependencies_parsed_at":"2024-11-09T17:17:36.163Z","dependency_job_id":"66391592-9d1d-4601-bd0e-d7f0dd42530f","html_url":"https://github.com/rluders/httpsuite","commit_stats":null,"previous_names":["rluders/httpsuite"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/rluders/httpsuite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fhttpsuite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fhttpsuite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fhttpsuite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fhttpsuite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rluders","download_url":"https://codeload.github.com/rluders/httpsuite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rluders%2Fhttpsuite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279296782,"owners_count":26142414,"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","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["golang","golang-package","requests","response","rest","validation"],"created_at":"2024-11-21T03:54:30.684Z","updated_at":"2025-10-17T06:45:02.395Z","avatar_url":"https://github.com/rluders.png","language":"Go","funding_links":["https://github.com/sponsors/rluders"],"categories":["Web Frameworks"],"sub_categories":["Utility/Miscellaneous"],"readme":"# httpsuite\n\nhttpsuite is a lightweight, idiomatic Go library that simplifies HTTP request parsing, validation, \nand response handling in microservices. It’s designed to reduce boilerplate and promote clean, \nmaintainable, and testable code — all while staying framework-agnostic.\n\n## ✨ Features\n\n- 🧾 **Request Parsing**: Automatically extract and map JSON payloads and URL path parameters to Go structs.\n- ✅ **Validation:** Centralized validation using struct tags, integrated with standard libraries like `go-playground/validator`.\n- 📦 **Unified Responses:** Standardize your success and error responses (e.g., [RFC 7807 Problem Details](https://datatracker.ietf.org/doc/html/rfc7807)) for a consistent API experience.\n- 🔌 **Modular Design:** Use each component independently — ideal for custom setups, unit testing, or advanced use cases.\n- 🧪 **Test-Friendly:** Decouple parsing and validation logic for simpler, more focused test cases.\n\n### 🔌 Supported routers\n\n- [Chi](https://github.com/go-chi/chi)\n- [Gorilla MUX](https://github.com/gorilla/mux)\n- Go standard `http.ServeMux`\n- ...and potentially more — [Submit a PR with an example!](https://github.com/rluders/httpsuite)\n\n## 🛠 Installation\n\nTo install **httpsuite**, run:\n\n```\ngo get github.com/rluders/httpsuite/v2\n```\n\n## 🚀 Usage\n\n```go\nimport (\n    \"github.com/go-chi/chi/v5\"\n    \"github.com/rluders/httpsuite/v2\"\n    \"net/http\"\n)\n\ntype SampleRequest struct {\n    ID   int    `json:\"id\" validate:\"required\"`\n    Name string `json:\"name\" validate:\"required,min=3\"`\n}\n\nfunc (r *SampleRequest) SetParam(fieldName, value string) error {\n    if fieldName == \"id\" {\n        id, err := strconv.Atoi(value)\n        if err != nil {\n            return err\n        }\n        r.ID = id\n    }\n    return nil\n}\n\nfunc main() {\n    r := chi.NewRouter()\n\n    r.Post(\"/submit/{id}\", func(w http.ResponseWriter, r *http.Request) {\n        req, err := httpsuite.ParseRequest[*SampleRequest](w, r, chi.URLParam, \"id\")\n        if err != nil {\n            return // ProblemDetails already sent\n        }\n\n        httpsuite.SendResponse(w, http.StatusOK, req, nil, nil)\n    })\n\n    http.ListenAndServe(\":8080\", r)\n}\n```\n\n💡 Try it:\n\n```\ncurl -X POST http://localhost:8080/submit/123 \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\"name\":\"John\"}'\n```\n\n## 📂 Examples\n\nCheck out the `examples/` folder for a complete working project demonstrating:\n\n- Full request lifecycle\n- Param parsing\n- Validation\n- ProblemDetails usage\n- JSON response formatting\n\n## 📖 Tutorial \u0026 Article\n\n- [Improving Request Validation and Response Handling in Go Microservices](https://medium.com/@rluders/improving-request-validation-and-response-handling-in-go-microservices-cc54208123f2)\n\n## 🤝 Contributing\n\nAll contributions are welcome! Whether it's a bug fix, feature proposal, or router integration example:\n\n- Open an issue\n- Submit a PR\n- Join the discussion!\n\n## 🪪 License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frluders%2Fhttpsuite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frluders%2Fhttpsuite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frluders%2Fhttpsuite/lists"}