{"id":19522210,"url":"https://github.com/captaincodeman/appengine-context","last_synced_at":"2026-06-07T21:31:27.123Z","repository":{"id":66357873,"uuid":"137392047","full_name":"CaptainCodeman/appengine-context","owner":"CaptainCodeman","description":"Middleware to access AppEngine context","archived":false,"fork":false,"pushed_at":"2018-06-14T18:05:06.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-08T14:15:28.668Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CaptainCodeman.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":"2018-06-14T18:03:30.000Z","updated_at":"2019-01-07T09:29:15.000Z","dependencies_parsed_at":"2023-02-23T04:16:01.747Z","dependency_job_id":null,"html_url":"https://github.com/CaptainCodeman/appengine-context","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCodeman%2Fappengine-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCodeman%2Fappengine-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCodeman%2Fappengine-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCodeman%2Fappengine-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CaptainCodeman","download_url":"https://codeload.github.com/CaptainCodeman/appengine-context/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240771906,"owners_count":19854982,"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-11T00:37:47.095Z","updated_at":"2026-06-07T21:31:27.047Z","avatar_url":"https://github.com/CaptainCodeman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# appengine-context\n\nHttp middleware to create an AppEngine context from the request\nand make it easy to retrieve it further down the call stack by\nsaving it into the request context. \n\nSee [this issue](https://github.com/golang/appengine/issues/99) for\nwhy this is necessary - calls to AppEngine services must be made \nusing a context created using the _original_ request and if you\nhave middleware storing things into the context, this replaces\nthe request with a clone which then interferes with your ability\nto call AppEngine services.\n\nThe code is tiny but I end up needing it in nearly every AppEngine\nproject so decided to package it up.\n\n## Installation\n\nInstall using `go get`\n\n    go get -i github.com/captaincodeman/appengine-context\n\n## Usage\n\nAdd the `Middleware` to your Router package of choice (or wrap\nthe standard http package Mux) and use the `Context` function\nwhenever you need to retrieve the AppEngine context to call any\nAppEngine services. The middleware should be added _before_ any\nother middleware that adds things to the request context.\n\nExample:\n\n```go\npackage demo\n\nimport (\n\t\"fmt\"\n\n\t\"net/http\"\n\n\t\"google.golang.org/appengine\"\n\t\"google.golang.org/appengine/log\"\n\n\t\"github.com/captaincodeman/appengine-context\"\n)\n\nfunc main() {\n\thandler := http.HandlerFunc(handle)\n\thttp.Handle(\"/\", gaecontext.Middleware(handler))\n\tappengine.Main()\n}\n\nfunc handle(w http.ResponseWriter, r *http.Request) {\n\tctx := gaecontext.Context(r)\n\n    // simple example just to demonstrate a call to\n    // an Appengine Service (stackdriver logging)\n    // using the context. This would work even if\n    // some other middleware added things into the\n    // request context ...\n\tlog.Debugf(ctx, \"saying hello\")\n\n\tfmt.Fprint(w, \"hello world!\")\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptaincodeman%2Fappengine-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaptaincodeman%2Fappengine-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptaincodeman%2Fappengine-context/lists"}