{"id":16766122,"url":"https://github.com/akshayjshah/memhttp","last_synced_at":"2025-09-14T22:34:35.561Z","repository":{"id":175491457,"uuid":"653973089","full_name":"akshayjshah/memhttp","owner":"akshayjshah","description":"In-memory HTTP for Go applications","archived":false,"fork":false,"pushed_at":"2023-06-15T06:29:07.000Z","size":12,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T19:36:41.107Z","etag":null,"topics":["connect-go","golang","http","testing"],"latest_commit_sha":null,"homepage":"https://go.akshayshah.org/memhttp","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/akshayjshah.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,"zenodo":null}},"created_at":"2023-06-15T06:15:49.000Z","updated_at":"2024-12-01T15:20:18.000Z","dependencies_parsed_at":"2024-02-06T05:45:34.984Z","dependency_job_id":null,"html_url":"https://github.com/akshayjshah/memhttp","commit_stats":null,"previous_names":["akshayjshah/memhttp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/akshayjshah/memhttp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fmemhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fmemhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fmemhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fmemhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akshayjshah","download_url":"https://codeload.github.com/akshayjshah/memhttp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayjshah%2Fmemhttp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266143941,"owners_count":23883069,"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":["connect-go","golang","http","testing"],"created_at":"2024-10-13T06:05:27.812Z","updated_at":"2025-07-20T15:03:51.139Z","avatar_url":"https://github.com/akshayjshah.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"memhttp\n=======\n\n[![Build](https://github.com/akshayjshah/memhttp/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/akshayjshah/memhttp/actions/workflows/ci.yaml)\n[![Report Card](https://goreportcard.com/badge/go.akshayshah.org/memhttp)](https://goreportcard.com/report/go.akshayshah.org/memhttp)\n[![GoDoc](https://pkg.go.dev/badge/go.akshayshah.org/memhttp.svg)](https://pkg.go.dev/go.akshayshah.org/memhttp)\n\n\n`memhttp` provides a full `net/http` server and client that communicate over\nin-memory pipes rather than the network. This is often useful in tests, where\nyou want to avoid localhost networking but don't want to stub out all the\ncomplexity of HTTP.\n\nOccasionally, it's also useful in production code: if you're planning to split a\nmonolithic application into microservices, you can first use `memhttp` to\nsimulate the split. This allows you to rewrite local function calls as HTTP\ncalls (complete with serialization, compression, and middleware) while\nretaining the ability to quickly change service boundaries.\n\nIn particular, `memhttp` pairs well with [`connect-go`][connect-go] RPC\nservers.\n\n## Installation\n\n```\ngo get go.akshayshah.org/memhttp\n```\n\n## Usage\n\nIn-memory HTTP is most common in tests, so most users will be best served by\nthe `memhttptest` subpackage:\n\n```go\nfunc TestServer(t *testing.T) {\n  hello := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n    io.WriteString(w, \"Hello, world!\")\n  })\n  // The server starts automatically, and it shuts down gracefully when the\n  // test ends. Startup and shutdown errors fail the test.\n  //\n  // By default, servers and clients use TLS and support HTTP/2.\n  srv := memhttptest.New(t, hello)\n  res, err := srv.Client().Get(srv.URL())\n  if err != nil {\n    t.Fatal(err)\n  }\n  if res.StatusCode != http.StatusOK {\n    t.Error(res.Status)\n  }\n}\n```\n\n## Status: Unstable\n\nThis module is unstable, with a stable release expected before the end of 2023.\nIt supports the [two most recent major releases][go-support-policy] of Go.\n\nWithin those parameters, `memhttp` follows semantic versioning. \n\n## Legal\n\nOffered under the [MIT license][license].\n\n[go-support-policy]: https://golang.org/doc/devel/release#policy\n[license]: https://github.com/akshayjshah/memhttp/blob/main/LICENSE\n[connect-go]: https://github.com/bufbuild/connect-go\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshayjshah%2Fmemhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakshayjshah%2Fmemhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshayjshah%2Fmemhttp/lists"}