{"id":21404717,"url":"https://github.com/eightyfive/koa-request-xhr","last_synced_at":"2026-01-03T00:44:02.521Z","repository":{"id":88370942,"uuid":"45518059","full_name":"eightyfive/koa-request-xhr","owner":"eightyfive","description":"Express req.xhr equivalent for Koa","archived":false,"fork":false,"pushed_at":"2016-01-01T09:08:23.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-24T06:02:39.906Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/eightyfive.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":"2015-11-04T05:47:58.000Z","updated_at":"2016-12-06T10:56:37.000Z","dependencies_parsed_at":"2023-03-16T18:00:37.744Z","dependency_job_id":null,"html_url":"https://github.com/eightyfive/koa-request-xhr","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"54995f326c687fc27d6ab62ea13d9cd43cd9515a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Fkoa-request-xhr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Fkoa-request-xhr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Fkoa-request-xhr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eightyfive%2Fkoa-request-xhr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eightyfive","download_url":"https://codeload.github.com/eightyfive/koa-request-xhr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902291,"owners_count":20366259,"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-22T16:17:42.682Z","updated_at":"2026-01-03T00:44:02.475Z","avatar_url":"https://github.com/eightyfive.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-request-xhr\nThis middleware simply sets a `xhr` boolean on koa's [`ctx.state`](https://github.com/koajs/koa/blob/master/docs/api/context.md#ctxstate) namespace.\n\nThis aims to be the equivalent of [Express `req.xhr`](http://expressjs.com/api.html#req.xhr)\n\n## Installation\n\n```\n$ npm install koa-request-xhr --save\n```\n\n## Example\n\n```js\nvar koa = require('koa');\nvar xhr = require('koa-request-xhr');\nvar app = koa();\n\napp.use(xhr());\napp.use(function *(){  \n  if (this.state.xhr) {\n    this.body = { message: 'Hello World' };\n  } else {\n    this.body = 'Hello World';\n  }\n});\n\napp.listen(3000);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feightyfive%2Fkoa-request-xhr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feightyfive%2Fkoa-request-xhr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feightyfive%2Fkoa-request-xhr/lists"}