{"id":22433653,"url":"https://github.com/gavinning/koa-requestid","last_synced_at":"2025-03-27T07:45:47.825Z","repository":{"id":57093683,"uuid":"254341901","full_name":"gavinning/koa-requestid","owner":"gavinning","description":"koa requestid, koa responseid","archived":false,"fork":false,"pushed_at":"2020-04-09T10:43:23.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T19:45:02.858Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/gavinning.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}},"created_at":"2020-04-09T10:34:49.000Z","updated_at":"2020-04-09T10:43:25.000Z","dependencies_parsed_at":"2022-08-22T21:40:26.843Z","dependency_job_id":null,"html_url":"https://github.com/gavinning/koa-requestid","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/gavinning%2Fkoa-requestid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fkoa-requestid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fkoa-requestid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fkoa-requestid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavinning","download_url":"https://codeload.github.com/gavinning/koa-requestid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245806390,"owners_count":20675296,"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-12-05T22:15:34.486Z","updated_at":"2025-03-27T07:45:47.796Z","avatar_url":"https://github.com/gavinning.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Koa-RequestId\n---\nkoa requestid, koa responseid\n\n### Install\n```sh\nnpm i @4a/koa-requestid\n```\n\n### Usage\n```js\nconst requestid = require('@4a/koa-requestid')\n\napp.use(requestid())\n\nrouter.get('/', (ctx) =\u003e {\n    console.log(ctx.ResponseId)\n})\n```\n\n### Notes\n```js\n// RequestId默认会从headers中查询，查询失败则使用uuid新建\nctx.RequestId = ctx.req.headers.requestId || ctx.req.headers['X-Request-Id'] || uuid.v4().toUpperCase()\n\n// 请求处理完毕RequestId会赋值给ResponseId，下游路由可以按需调用\nctx.ResponseId = ctx.RequestId\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinning%2Fkoa-requestid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavinning%2Fkoa-requestid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinning%2Fkoa-requestid/lists"}