{"id":34133762,"url":"https://github.com/karlpokus/routest","last_synced_at":"2026-01-12T03:00:07.546Z","repository":{"id":114675389,"uuid":"214889385","full_name":"karlpokus/routest","owner":"karlpokus","description":"Simpler http api tests in go","archived":false,"fork":false,"pushed_at":"2020-05-05T13:11:43.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-17T12:22:00.436Z","etag":null,"topics":["api","go","http","testing"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/karlpokus/routest","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/karlpokus.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":"2019-10-13T20:30:17.000Z","updated_at":"2020-05-05T13:11:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"6e529156-01ea-429d-96b8-ea9f7d8f8e32","html_url":"https://github.com/karlpokus/routest","commit_stats":null,"previous_names":["karlpokus/routerino"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/karlpokus/routest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlpokus%2Froutest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlpokus%2Froutest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlpokus%2Froutest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlpokus%2Froutest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karlpokus","download_url":"https://codeload.github.com/karlpokus/routest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlpokus%2Froutest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28332831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"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":["api","go","http","testing"],"created_at":"2025-12-15T01:13:07.660Z","updated_at":"2026-01-12T03:00:07.515Z","avatar_url":"https://github.com/karlpokus.png","language":"Go","readme":"# routest\nFast and easy way of testing your http api. Works with the stdlibs `testing` pkg.\n\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/karlpokus/routest/v2)\n\n# install\n```bash\n$ go get github.com/karlpokus/routest/v2\n```\n\n# usage\nTest a route\n```go\nimport (\n\t// ...\n\t\"github.com/karlpokus/routest/v2\"\n)\n\nfunc hi(s string) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Etag\", \"abc\")\n\t\tfmt.Fprintf(w, \"hi %s\", s)\n\t}\n}\n\nfunc TestRoute(t *testing.T) {\n\troutest.Test(t, nil, []routest.Data{\n\t\t{\n\t\t\tName: \"hi from route\",\n\t\t\tPath: \"/\",\n\t\t\tHandler: hi(\"bob\"),\n\t\t\tStatus: 200,\n\t\t\tResponseBody: []byte(\"hi bob\"),\n\t\t\tResponseHeader: http.Header{\n\t\t\t\t\"Etag\": []string{\"abc\"},\n\t\t\t},\n\t\t},\n\t})\n}\n```\nTest registered routes\n```go\nimport (\n\t// ...\n\t\"github.com/karlpokus/routest/v2\"\n\t\"github.com/julienschmidt/httprouter\"\n)\n\nfunc Greet(w http.ResponseWriter, r *http.Request) {\n\tparams := httprouter.ParamsFromContext(r.Context())\n\tfmt.Fprintf(w, \"hello %s\", params.ByName(\"user\"))\n}\n\nfunc TestRouter(t *testing.T) {\n\troutest.Test(t, func() http.Handler {\n\t\trouter := httprouter.New()\n\t\trouter.HandlerFunc(\"GET\", \"/greet/:user\", Greet)\n\t\treturn router\n\t}, []routest.Data{\n\t\t{\n\t\t\tName: \"Greet from router\",\n\t\t\tMethod: \"GET\",\n\t\t\tPath: \"/greet/bob\",\n\t\t\tStatus: 200,\n\t\t\tResponseBody: []byte(\"hello bob\"),\n\t\t},\n\t})\n}\n```\n\n# todos\n- [x] allow for custom server/router to register as handler\n- [x] fix v2 module path\n- [x] Add http.Header to Data\n- [x] Make some Data fields optional\n- [ ] v3 no need for path for testing routes, no need for handler if testing a router\n- [ ] v3 remove httprouter dependency\n\n# license\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarlpokus%2Froutest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarlpokus%2Froutest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarlpokus%2Froutest/lists"}